Difference between revisions of "User talk:Rael"

From Teknologisk videncenter
Jump to: navigation, search
m (Her og nu husk)
m (Tillad Sudo uden password)
 
(8 intermediate revisions by the same user not shown)
Line 45: Line 45:
  
 
=Sandkasse=
 
=Sandkasse=
 +
==Netværks Fun==
 +
===Loopback Script===
 +
Et lille script der laver loopback interfaces som senere kan bruges til summeringer.
 +
<source lang=cli>
 +
for(var i = 1; i<100;i++)
 +
{
 +
    $("#content").append("int lo "+i+"<br />");
 +
    $("#content").append("ipv add 2001:db8:01"+pad(i, 2)+"::1/128<br />");
 +
    $("#content").append("ipv ospf 1 a 1<br />");
 +
    $("#content").append("!<br />");
 +
}
 +
 +
function pad(num, size) {
 +
    var s = num+"";
 +
    while (s.length < size) s = "0" + s;
 +
    return s;
 +
}
 +
</source>
 +
[http://jsfiddle.net/Cq3Ts/1/ Fiddle Link]
 
==Vis hukommelse på Windows Computer==
 
==Vis hukommelse på Windows Computer==
 
<pre>wmic MEMORYCHIP get banklabel, devicelocator, caption, capacity</pre>
 
<pre>wmic MEMORYCHIP get banklabel, devicelocator, caption, capacity</pre>
Line 72: Line 91:
 
{{TOCright}}
 
{{TOCright}}
 
</pre>
 
</pre>
 +
==Source CLI==
 +
<pre>
 +
{{Source cli}}
 +
</pre>
 +
 
==In Progress==
 
==In Progress==
 
<pre>
 
<pre>
Line 77: Line 101:
 
</pre>
 
</pre>
 
==Section include==
 
==Section include==
 +
<pre>{{:Article}}</pre>
 +
 
==Ubuntu 11.xx fix==
 
==Ubuntu 11.xx fix==
 
Hvis systemet ikke kommer med en login prompt efter instllation/upgradering
 
Hvis systemet ikke kommer med en login prompt efter instllation/upgradering
Line 111: Line 137:
 
<source lang=bash>
 
<source lang=bash>
 
for i in *.JPG; do convert -resize 800 -quality 90 $i TN_$i; echo $i processed; done
 
for i in *.JPG; do convert -resize 800 -quality 90 $i TN_$i; echo $i processed; done
 +
</source>
 +
Kør din konvertering parallelt:
 +
<source lang=cli>
 +
ls -1 *.jpg | parallel -j 5 --eta convert -resize 800 -quality 90 '{}' 'TN_{.}.jpg'
 +
#Eksempel fra MAC'en
 +
Dafs-MacBook-Air:101CANON rael$ sudo port install parallel
 +
Dafs-MacBook-Air:101CANON rael$ ls -1 *.JPG | parallel -j 5 --eta convert -resize 800 -quality 90 '{}' 'thumb/TN_{.}.jpg'
 +
 +
Computers / CPU cores / Max jobs to run
 +
1:local / 4 / 5
 +
 +
Computer:jobs running/jobs completed/%of started jobs/Average seconds to complete
 +
ETA: 1688s 2210left 0.76avg  local:5/88/100%/0.8s
 
</source>
 
</source>
 
Time comparision(on the Raspberry PI):
 
Time comparision(on the Raspberry PI):
Line 172: Line 211:
 
dpkg-reconfigure locales
 
dpkg-reconfigure locales
 
</source>
 
</source>
 +
==IPv4 apt-get==
 +
<pre>
 +
apt-get -o Acquire::ForceIPv4=true install screen htop nmon -y
 +
</pre>
 +
 +
==Tillad Sudo uden password==
 +
her får pi brugeren lov til at sudo uden password
 +
nano /etc/sudoers
 +
<pre>
 +
pi ALL=(ALL) NOPASSWD: ALL
 +
</pre>
  
 
==Top Linux Tools==
 
==Top Linux Tools==
 
http://www.cyberciti.biz/tips/top-linux-monitoring-tools.html
 
http://www.cyberciti.biz/tips/top-linux-monitoring-tools.html

Latest revision as of 14:54, 18 February 2016

Mono Project News
<rss>http://www.mono-project.com/news/index.rss2%7Cshort%7Cmax=3%7Chighlight</rss>


Cisco Security News
<rss>http://newsroom.cisco.com/data/syndication/rss2/news_at_cisco_5Security.xml%7Cshort%7Cmax=3%7Chighlight</rss>


Cuda News
<rss>http://www.nvidia.com/content/cudazone/CUDABrowser/assets/data/rss_en-us.xml%7Cshort%7Cmax=3%7Chighlight</rss>


Windows Team Blog
<rss>http://windowsteamblog.com/windows_live/b/windowslive/rss.aspx%7Cshort%7Cmax=3%7Chighlight</rss>


Nmap Hackers

Noter:
http://blinkdagger.com/matlab/matlab-tips-and-tricks-on-manipulating-1-d-arrays-vectors/
http://www.howtoforge.com/using-iscsi-on-ubuntu-9.04-initiator-and-target
https://help.ubuntu.com/community/PXEInstallMultiDistro#SYSLINUX <- til tirsdag syslinux
http://www.howtoforge.com/how-to-set-up-webdav-with-apache2-on-ubuntu-8.10
http://www.getipv6.info/index.php/Cisco_6to4_Relay_Service
http://bgp.he.net/ipv6-progress-report.cgi
http://docwiki.cisco.com/wiki/IOS_IP_SLAs_for_IPv6_White_Paper
http://www.txv6tf.org/wp-content/uploads/2010/08/McFarland-Tutorial-ent-v6-deploy.pdf
http://beginlinux.com/blog/2009/01/ssl-on-ubuntu-810-apache2/
https://help.ubuntu.com/community/RootSudo

Her og nu husk

Rasp links

Sandkasse

Netværks Fun

Loopback Script

Et lille script der laver loopback interfaces som senere kan bruges til summeringer.

for(var i = 1; i<100;i++)
{
    $("#content").append("int lo "+i+"<br />");
    $("#content").append("ipv add 2001:db8:01"+pad(i, 2)+"::1/128<br />");
    $("#content").append("ipv ospf 1 a 1<br />");
    $("#content").append("!<br />");
}

function pad(num, size) {
    var s = num+"";
    while (s.length < size) s = "0" + s;
    return s;
}

Fiddle Link

Vis hukommelse på Windows Computer

wmic MEMORYCHIP get banklabel, devicelocator, caption, capacity

Fjern tomme foldere på linux

#remove empty directories from this dir that isnt modifies within the last 60 min.
find . -maxdepth 1 -mmin +60 -type d -empty -exec rmdir {} \;
# move alle directories staring with 45 not modified within the last 20 houts(1200min) to 130217
find 45* -type d -mmin +1200 -exec mv {} 130217 \;

Definition Lists

http://www.mediawiki.org/wiki/Help:Formatting

;item 1
: definition 1
;item 2
: definition 2-1
: definition 2-2
item 1
definition 1
item 2
definition 2-1
definition 2-2

TOC Right

{{TOCright}}

Source CLI

{{Source cli}}

In Progress

{{In progress}}

Section include

{{:Article}}

Ubuntu 11.xx fix

Hvis systemet ikke kommer med en login prompt efter instllation/upgradering

  1. alt+højre pil
  2. slette splash fra /etc/default/grub
  3. update-grub

Show Cron Jobs

This is how to show cron jobs from all users

for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done

Copy Pub key to server

cat .ssh/id_rsa.pub | ssh git.tekkom.dk "cat >> .ssh/authorized_keys"

Ændre tidszonen

dpkg-reconfigure tzdata

Apache log analyzer

zcat access.log.*.gz | cut -d' ' -f1 | sort | uniq -c | sort -h -r -b | head -n 50 | while read cnt ip; do echo -ne "$cnt\t"; echo -ne "$ip "; echo -e "(`dig -x $ip | grep PTR | grep -v -E '^;' | tr ' \t' ' '|cut -d' ' -f5`)"; echo -e "`whois $ip| grep address | head -n1 | sed -e 's/^address:*/\t/'`"; done

Convert Images on Linux

To Thumbs

Alt dette piping sletter EXIF data

for i in *.JPG; do djpeg $i | pnmscale -width 800 | cjpeg -opti -progr -qual 90 > TN_$i; echo $i processed; done

Brug convert istedet den bevarer EXIF

for i in *.JPG; do convert -resize 800 -quality 90 $i TN_$i; echo $i processed; done

Kør din konvertering parallelt:

ls -1 *.jpg | parallel -j 5 --eta convert -resize 800 -quality 90 '{}' 'TN_{.}.jpg'
#Eksempel fra MAC'en
Dafs-MacBook-Air:101CANON rael$ sudo port install parallel
Dafs-MacBook-Air:101CANON rael$ ls -1 *.JPG | parallel -j 5 --eta convert -resize 800 -quality 90 '{}' 'thumb/TN_{.}.jpg'

Computers / CPU cores / Max jobs to run
1:local / 4 / 5

Computer:jobs running/jobs completed/%of started jobs/Average seconds to complete
ETA: 1688s 2210left 0.76avg  local:5/88/100%/0.8s

Time comparision(on the Raspberry PI):

# time djpeg DSCN1111.JPG | pnmscale -width 800 | cjpeg -opti -progr -qual 90 > TN_DSCN1111.JPG

real    0m37.604s
user    0m25.870s
sys     0m1.750s

# time convert -resize 800 -quality 90 DSCN1111.JPG TN2_DSCN1111.JPG

real    5m9.545s
user    2m19.830s
sys     0m8.250s

Time comparision(I386):

# time djpeg IMG_0722.JPG | pnmscale -width 800 | cjpeg -opti -progr -qual 90 > TN_IMG_0722.JPG

real    0m0.916s
user    0m1.108s
sys     0m0.092s

# time convert -resize 800 -quality 90 IMG_0722.JPG TN2_IMG_0722.JPG

real    0m2.536s
user    0m2.844s
sys     0m0.132s

Hvis den skal tælle op kan man bruge denne for løkke.

t=1; w=`ls -l | wc -l`; for i in *.JPG; do let t++ ; echo "Converted $i($t/$w)"; done

From BMP to JPG

for i in *.bmp; do convert $i $(basename $i bmp)jpg ; echo "Converted $i"; done

Configure Ubuntu to send mail on logon

aptitude install sendemail -y # Ja det er sendemail og ikke sendmail
echo "echo besked" | sendemail -f mailaddr@mydomain.local -t bruger@domain.local -u subject -s smtp.maildomain.local

Tilføj en linie i bunden af /etc/profile. Denne fil bliver kørt hver gang en bruger logger ind.

echo -e "$USER er loggint ind, her er de øvrige brugere: \n `who`" | sendemail -f mailaddr@mydomain.local -t bruger@domain.local -u subject -s smtp.maildomain.local

Fix ubuntu perl Language problem

apt-get install language-pack-en-base


export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales

IPv4 apt-get

apt-get -o Acquire::ForceIPv4=true install screen htop nmon -y

Tillad Sudo uden password

her får pi brugeren lov til at sudo uden password nano /etc/sudoers

pi ALL=(ALL) NOPASSWD: ALL

Top Linux Tools

http://www.cyberciti.biz/tips/top-linux-monitoring-tools.html