To utilise this web-page in plain text format, e.g. with grep or emacs, you might want to remove/convert some HTML tags: sed -e 's/</</g' -e 's/>/>/g' -e '/^<pre>$/d' -e '/^<\/pre>$/d' linux.html > linux.txt Seppo Heikkila, last updated: 2020-08-15 |
Command [extra params] | Description |
---|---|
man command | Shows the manual-page for command. |
info command | Shows the info-page for command(more detailed than man). |
cp [-R] from_where to_where | Copy files from place to place. |
mv from_where to_where | Move files from place to place. |
rm [-rf] target_file | Remove files |
du [-sk] | disk usage in kilobytes |
swapon [-s] | swap usage (summary) |
free | displays free memory and swap resources |
dmidecode | Dump DMI (SMBIOS) table to human readable format |
cardctl | PCMCIA card control utility ( e.g. cardctl ident) |
top | displays the top CPU processes |
ln [-s] real_dir_name link_name | make hard or symbolic links to files |
locate file_name | search for files |
mount /dev/device /mnt_place [-o uid=user,gid=group,umask=0007] | Sets up(mounts) a file system to /mnt_place directory. |
umount /dev/device | Unmounts the wanted device. |
dmesg | print or control the kernel ring buffer. |
root0:x:102:ssheikki,www-dataTo show the groups where user_name belongs to:
groups user_name
Set the responsiveness (normally not needed) [1]? > 10 Repeat protocol (enter 'none' to turn repeating off) [raw]? > Do you want to add any additional arguments []? > Do you want to test this configuration (y/N)? y gpm -m /dev/psaux -t imps2 -r 10 -Rraw Finish testing by typing Ctrl-D Current configuration: -m /dev/psaux -t imps2 -r 10 -Rraw Device: /dev/psaux Type: imps2 Responsiveness: 10 Repeat_Type: raw
if `kernelversion` == 2.4 uhci emu10k1 ... elseif `kernelversion` == 2.6 uhci-hcd snd-emu10k1 ... endif
/dev/hda: multcount = 16 (on) I/O support = 1 (32-bit) unmaskirq = 1 (on) using_dma = 1 (on) keepsettings = 0 (off) nowerr = 0 (off) readonly = 0 (off) readahead = 8 (on) geometry = 19457/255/63, sectors = 312581808, start = 0 busstate = 1 (on)and acceptable speed for example:
ssheikki:~# hdparm -Tt /dev/hda /dev/hda: Timing buffer-cache reads: 128 MB in 0.43 seconds =297.67 MB/sec Timing buffered disk reads: 64 MB in 1.17 seconds = 54.70 MB/secIf you get "HDIO_SET_DMA failed: Invalid argument", when setting hdparm -d1 /dev/hda then your kernel is missing VIA module. Select it from:
ATA/IDE/MFM/RLL support ---> IDE, ATA and ATAPI Block devices ---> <*> VIA82CXXX chipset supportFor real world tests:
Section "InputDevice" Identifier "Keyboard0" Driver "keyboard" Option "XkbRules" "xorg" Option "XkbModel" "pc105" # pc105 is finnish Option "XkbLayout" "fi" EndSection
debian:/usr/src/kernel/linux-2.6.7# grep -i usb .config | grep -v "#" CONFIG_USB=m CONFIG_USB_DEVICEFS=y CONFIG_USB_EHCI_HCD=m CONFIG_USB_UHCI_HCD=m CONFIG_USB_HID=m CONFIG_USB_HIDINPUT=y
other=/dev/hdb2 label="Windows" table=/dev/hdb map-drive=0x80 to=0x81 map-drive=0x81 to=0x80It changes the active disk in the boot so Windows will be booted unnoticed.
ssheikki@jt11-231-2:/$ traceroute 193.167.3.129 traceroute to 193.167.3.129 (193.167.3.129), 30 hops max, 38 byte packets 1 jt11-231-2 (193.167.3.129) 0.061 ms 0.020 ms 0.014 msTest in computer where loopBack adapter isn't used:
ssheikki@jt7-236:~$ traceroute 193.167.3.129 traceroute to 193.167.3.129 (193.167.3.129), 30 hops max, 38 byte packets 1 trinet-gw (130.233.31.254) 2.303 ms 2.331 ms 3.403 ms 2 gw-2-v96.hut.fi (130.233.231.19) 0.899 ms 0.634 ms 0.681 ms 3 u35211.win.hut.fi (193.167.3.129) 0.833 ms 4.314 ms 0.591 ms
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule rewrite_module modules/mod_rewrite.so Options Indexes FollowSymLinks ExecCGIAllowOverride None Options +ExecCGI Order allow,deny Allow from all RewriteEngine on RewriteLog C:/tomcat/rewrite.log RewriteLogLevel 9 RewriteRule ^/cgi-bin/java\-rmi\.cgi$ http://localhost/examples/servlet/ServletHandler [P]LoadModule jk_module C:/Winnt/system32/mod_jk_1.2.5_2.0.47.dll JkWorkersFile "C:/tomcat/conf/workers.properties" JkLogFile "C:/tomcat/logs/mod_jk.log" JkLogLevel info JkMount /manager ajp13 JkMount /manager/* ajp13 JkMount /examples ajp13 JkMount /examples/* ajp13 JkMount /tomcat-docs ajp13 JkMount /tomcat-docs/* ajp13 JkMount /webdav ajp13 JkMount /webdav/* ajp13 JkMount /*.jsp ajp13
workers.tomcat_home=C:/tomcat workers.java_home=C:\j2sdk1.4.2_01 ps=\ worker.list=ajp13, ajp14 worker.ajp13.port=8009 worker.ajp13.host=localhost worker.ajp13.type=ajp13 worker.ajp13.lbfactor=1 worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=ajp13 worker.inprocess.type=jni worker.inprocess.class_path=$(workers.tomcat_home)$(ps)server$(ps)lib$(ps)catalina.jar worker.inprocess.cmd_line=start worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)server$(ps)jvm.dll worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
for image in *.jpg do echo "Processing: $image ..." convert -resize 15x15% $image thumbs/$image echo "done." done
mkdir __tmp for image in *.gif do if [ $image_prev ] ; then diffout="`diff $image_prev $image | wc -l`" if [ $diffout = "0" ] ; then echo "Identical images: $image_prev $image, not processed." else convert -resize 100x100% $image __tmp/$image echo "Image $image processed." fi else convert -resize 100x100% $image __tmp/$image echo "Image $image processed." fi image_prev=$image done ./gifmerge -l0 -10 __tmp/*.gif > anim.gif rm -rf __tmp echo "Output should be here:" ls -laF anim.gif echo "done."
root@debian:/# whereis whereis whereis: /usr/bin/whereis /usr/share/man/man1/whereis.1.gz
To create for exaple alias for jt11-117-3.tky.hut.fi master zone tky.hut.fi and the name alias jt11-117-3For easy configuration, please install webmin.
Device Boot Start End Blocks Id System /dev/sdb1 1 1824 14651248+ c W95 FAT32 (LBA) /dev/sdb2 4256 30401 210017745 5 Extended /dev/sdb3 1825 4255 19527007+ c W95 FAT32 (LBA) /dev/sdb5 * 4256 5471 9767488+ 83 Linux /dev/sdb6 5472 30401 200250193+ 83 LinuxNow evetyhing is ok but the Extended type is wrong. Let's change it with fdisk.
Command (m for help): t Partition number (1-6): 2 Hex code (type L to list codes): L Hex code (type L to list codes): f Command (m for help): wNow the table looks like this:
Device Boot Start End Blocks Id System /dev/sdb1 1 1824 14651248+ c W95 FAT32 (LBA) /dev/sdb2 4256 30401 210017745 f W95 Ext'd (LBA) /dev/sdb3 1825 4255 19527007+ c W95 FAT32 (LBA) /dev/sdb5 * 4256 5471 9767488+ 83 Linux /dev/sdb6 5472 30401 200250193+ 83 Linux
usedb wikidb; rename table sm_old to sm_text;
Host aut40 Hostname yourserver.ftl Port 49490 HostKeyAlias aut40 CheckHostIP no Host lap Hostname yourserver.ftl Port 49491 HostKeyAlias lap CheckHostIP no
usbstick -fstype=vfat,rw,gid=100,umask=002 :/dev/sda1 cdrom -fstype=iso9660,ro,sync,nodev,nosuid :/dev/hdcCreate symbol links to this paths
Host lap Hostname asrobo.hut.fi Port 49491 HostKeyAlias lap CheckHostIP no
ifconfig eth0 IP netmask MASK up route add -net default gw GATEWAY netmask 0.0.0.0 eth0 hostname HOSTNAME echo ``domain DOMAIN'' >/etc/resolv.conf echo "nameserver DNS" >>/etc/resolv.conf
:~# mii-tool -v eth0 eth0: negotiated 100baseTx-FD flow-control, link ok product info: vendor 00:07:32, model 17 rev 3 basic mode: autonegotiation enabled basic status: autonegotiation complete, link ok capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
:~# ethtool eth0 Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000033 (51) Link detected: yesipref measures the traffic between two comptures. Other computer is server and the other computer is client.
mkisofs -o cd.iso -J -R /tmp/mycd cdrecord -scanbus cdrecord dev=x,y,z -multi speed=0 -data cd.iso
To convert file.txt coming from a Macintosh: recode mac..latin1 file.txt To convert from DOS codepage 850 to unix latin1: recode 850..latin1 file.txt To just remove ^ M: recode l1/crlf..l1 file.txt To convert from Windows codepage 1250 to unix latin 1 (iso-8859-1): recode ms-ee..l1 file.txt
Maybe use 'xfig' to construct complex graphics. Yet the ergonomy of xfig is very different from what users expect nowadays. You can try 'sketch', 'dia' or OpenOffice draw. Or inkscape. For mathematical plots, bar plots..., I use the data analysis package R. For simple things, gnuplot may also help.
~# arping 00:0D:F0:14:B8:22 ARPING 00:0D:F0:14:B8:22 60 bytes from 192.168.1.1 (00:0d:f0:14:b8:22): icmp_seq=0 time=434.160 usec 60 bytes from 192.168.1.1 (00:0d:f0:14:b8:22): icmp_seq=1 time=425.100 usec
network={ ssid="myHost" #psk="myPassPhrase" psk=0d0800c35ab28ba9ed417863ade1ddc3ec38b9490ed633f99081cae4ac65c39e }Insert it into /etc/wpa_supplicant/wpa_supplicant.conf. 2) Run these commands:
auto wlan0 iface wlan0 inet dhcp up wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -Bw down killall wpa_supplic
Install automake. autoconf -- to get autoheader,autoconf libtool -- to get libtool, libtoolize
field allowed values ----- -------------- minute 0-59 hour 0-23 day of month 1-31 month 1-12 (or names, see below) day of week 0-7 (0 or 7 is Sun, or use names)To add a crontab for a user, write "crontab -e":
sudo module-assistant prepare sudo module-assistant update sudo module-assistant build fglrx sudo module-assistant install fglrx sudo depmod -a
auto wlan0 iface wlan0 inet dhcp wireless-essid <youressid> wireless-key s:<yourwepkey> open
ufw enable ufw logging on sudo ufw allow 53/tcp sudo ufw allow ssh
svga.maxWidth = "1280" svga.maxHeight = "800"You can also try if above does not work:
sudo gedit ~/vmware/preferences - Now where it says: pref.autoFitFullScreen = "fitHostToGuest" change it to: pref.autoFitFullScreen = "fitGuestToHost"
sudo dpkg-reconfigure -phigh linux-restricted-modules-`uname -r` sudo insmod /lib/modules/`uname -r`/volatile/fglrx.ko
# load/unload the volume settings on startup/shutdown install snd-driver-name /sbin/modprobe \ --ignore-install snd-driver-name;/usr/sbin/alsactl restore remove snd-driver-name /usr/sbin/alsactl \ store;/sbin/modprobe --ignore-remove -r snd-driver-name
smartctl -H /dev/hda smartctl -l error /dev/hda,
- aide (files) - tiger (services) - rootkit (rootkits)
# Be sure to install libpam-cracklib first or you will not be able to log in password required pam_cracklib.so retry=3 minlen=10 difok=3 password required pam_unix.so use_authtok nullok md5 remember=3
# Default action to take: ban & send an e-mail with whois report # and relevant log lines to the destemail. action = iptables[name=%(__name__)s, port=%(port)s] mail-whois-lines[name=%(__name__)s, dest=%(destemail)s, logpath=%(logpath)s]and
[ssh] enabled = true port = ssh filter = sshd logpath = /var/log/auth.log maxretry = 12 bantime = 3600 findtime = 600 ignoreip = 130.233.120.0/24
(Parameter.set 'Audio_Method 'Audio_Command) (Parameter.set 'Audio_Command "aplay -q -c 1 -t raw -f s16 -r $SR $FILE")
115200 proxyarp 192.168.168.1:192.168.168.50 local ms-dns 130.233.224.1 noauth debug ktuneStart the service daemon:
Insert this in .asoundrc file: pcm.!default { type bluetooth device "00:0D:44:0A:6D:C3" profile "auto" }
Stop: kill -STOP <PIDNUM> Continue: kill -CONT <PIDNUM> Abort: kill -ABRT <PIDNUM> For more commans, see "man kill".
nc 130.233.125.68 80 GET /yourstuffmorehere HTTP/1.1 Host: spacemaster.eu
menuentry "Windows" { insmod ntfs set root=(hd0,1) search --no-floppy --fs-uuid --set YOUR_UUID_FROM_DEV_DISK_BY_UUID chainloader +1 }
#include <sys/time.h> struct timespec start, stop; clock_gettime(CLOCK_REALTIME,&start); clock_gettime(CLOCK_REALTIME,&stop); double duration= (stop.tv_sec - start.tv_sec) + (double)(stop.tv_nsec - start.tv_nsec) / 1000000000.0; printf("time elapsed = %.9f s", duration); g++ -lm -Wall -lrt main.cpp
DE avi AVI format DE matroska Matroska file format E mp4 MP4 formatffmpeg -codecs
D V D h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 EA libfaac libfaac AAC (Advanced Audio Codec) EA libmp3lame libmp3lame MP3 (MPEG audio layer 3) EV libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 DEV D mjpeg MJPEG (Motion JPEG) DEVSDT mpeg1video MPEG-1 video DEVSD msmpeg4 MPEG-4 part 2 Microsoft variant version 3 DEV D qtrle QuickTime Animation (RLE) video DEA vorbis Vorbis DEVSD wmv2 Windows Media Video 8
Do these: echo -e "\n# libv4l PPA\ndeb http://ppa.launchpad.net/libv4l/ppa/ubuntu `lsb_release -c | awk '{print $2}'` main" | sudo tee -a /etc/apt/sources.list sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com C3FFB4AA sudo aptitude update sudo aptitude install libv4l-0 LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so application_name
bytes-per-inode: 1MB Block size: 4096 Inode size: 128Note that http://www.ext2fsd.com supports the larger 256 inode size!
1 00:00:00,000 --> 00:02:57,040 3xmencoder -sub test.srt -subpos 0 -subfont-text-scale 7 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=800:vhq -oac copy -o test2.avi test.avi
+-------------+---------------------------+------+-----+---------------------+-----------------------------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------------------+------+-----+---------------------+-----------------------------+ | emailcrons | tinyint(4) | NO | | 0 | | +-------------+---------------------------+------+-----+---------------------+-----------------------------+If somethings goes wrong, use DROP COLUMN:
1) If something is screwed up * Select your project and press right key * Maven -> Update Project Configuration 2) If you want to get maven project from svn * Select import in eclipse * write maven and select "existing maven projects"
nm-connection-editor gnome-control-center network gnome-nettool
amixer -q set Master toggle unmute amixer -q set Master 2+ unmute && amixer -q set Speaker 2+ unmute && amixer -q set Headphone 2+ unmute amixer -q set Master 2- unmute && amixer -q set Speaker 2- unmute && amixer -q set Headphone 2- unmute
optirun nvidia-settings -c :8 To see if Nvidia is in use: cat /proc/acpi/bbswitch
8.14 Watts on Average with Standard Deviation 0.18 sudo pm-powersave true 8.38 Watts on Average with Standard Deviation 0.15 Note: Does not seem to be useful.
sudo add-apt-repository ppa:colin-king/powermanagement sudo apt-get update sudo apt-get install powerstat powerstat
gnome-power-statistics Maybe also: battery-stats-collector
Graphical tools: lxrandr, arandr Manual: xrandr cvt 1920 1080 60 xrandr --newmode <ADD_CVT_OUTPUT_HERE> xrandr --addmode eDP1 "1920x1080_60.00" xrandr --output eDP1 --mode "1920x1080_60.00" --rate 60 --fbmm 295x166
sudo update-alternatives --config java sudo update-alternatives --config javac
mencoder -ovc copy -oac copy input*.AVI -o joined.avi kdenlive # Install before x264, etc. properietary codecs # These did NOT work properly: ghb # http://handbrake.fr/ avimerge -i input*.AVI -o joined.avi avisync -o synced.avi -i joined.avi -n 90 # 30fps => 3.6s delay
sudo apt-get install davfs2 && sudo modprobe coda mount.davfs http://localhost/owncloud/remote.php/webdav/ mnt
aptitude install collectd sudo cp -R /usr/share/doc/collectd/examples/collection3 /var/www/ sudo apt-get install librrds-perl libconfig-general-perl libhtml-parser-perl libregexp-common-perl http://localhost/collection3/bin/
apt-get install pavucontrol pavucontrol # change in Recording tab, ALSA capture from to "Monitor of..." recordmydesktop -x 50 -y 50 --width 640 --height 320 --fps 30 --full-shots -o output.ogg --device pulse
Preferred way is to require good quality: ffmpeg -i input.avi -c:v libx264 -preset veryslow -crf 18 -c:a copy output.mkv If original is 582MB, then veryslow is 152MB (26%) and slow is 163MB (28%). If you want to have fixed file size: ffmpeg -threads 4 -i joined.avi -vcodec libx264 -filter:v yadif -b 3000k -cmp +chroma -g 250 -partitions +parti4x4+partp8x8+partb8x8 -i_qfactor 0.71 -keyint_min 25 -b_strategy 1 -flags +loop -acodec copy output.avi
melt input.avi -filter videostab4 shakiness=4 -consumer xml:temp.xml all=1 real_time=-2 melt temp.xml -audio-track input.avi -consumer avformat:output.mp4 vcodec=libx264 crf=18 tune=film preset=slow
It seems that the basic audio format "uncompressed PCM (mono, 8000 Hz)", does not work well with kdenlive. There is strange noise every now and then. One solution is to convert the videos to use lossless flac codec: ffmpeg -i PA100038.AVI -c:v copy -c:a flac ../PA100038.AVI You get good quality output at least with Theora codec.
svnadmin create newrepo echo '#!/bin/sh' > newrepo/hooks/pre-revprop-change chmod 755 newrepo/hooks/pre-revprop-change svnsync init file:///home/ssheikki/Desktop/newrepo https://svn.kapsi.fi/ssheikki --source-username=ssheikki --sync-username=ssheikki svnsync sync file:///home/ssheikki/Desktop/newrepo --source-username=ssheikki --sync-username=ssheikki --sync-password=syncPassword
Press Ctrl+A + [ Press esc to return to normal mode.
dig @ns1.giraf.fi www.mielipiteet.fi dig @a.ns.joker.com www.vapahtaja.com Your IP should be found in the ANSWER section.
Add entry to /etc/apache2/sites-available
sudo a2ensite <your_entry> service apache2 reload
gpg -c yourfile.tar gpg yourfile.tar.gpg
screen -S "newscreen" -d -m bash -c "sleep 100" screen -t "newwindow" bash -c "sleep 100"
type echo type ls type dir
find . -name '*.c' | xargs wc -l find . -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h" | xargs wc -l | sort -rn - find . \( -name "*.c" -o -name "*.h" \) -a ! -path "*2011*" | xargs wc -l | sort -rn - cloc /path/to/be/analysed1 /path/to/be/analysed2 \ --counted=/output/path/of/recognised/files/counted_files.txt \ --exclude-lang=m4,HTML, \ --exclude-dir=test,backup \ --not-match-f=\#
sudo apt-get install uml-utilities Add in host /etc/network/interfaces: auto tap0 iface tap0 inet manual up ifconfig $IFACE 172.16.1.1 netmask 255.255.255.0 up down ifconfig $IFACE down tunctl_user <user> sudo ifup tap0 Then you need to bridge to tap0 in the guest and add in guest's /etc/network/interfaces: auto eth1 iface eth1 inet static address 172.16.1.2 netmask 255.255.255.0 Now you should be able to access 172.16.1.1 and 172.16.1.2, respectively.
apt-get install module-assistant dkms m-a prepare m-a update m-a a-i <your-module>
losetup -a Print next free: losetup -f
lsof /dev/yourdevice ps aux | grep PIDwithOpenFile kill -9 PID # If it is e.g. terminal
echo $((2*3)) # Integers only echo "6.6*2.4" | bc
http://jetstrap.com/ http://twitter.github.com/bootstrap/
links "http://some.url/pdf.pdf" Press "f" to save the file.
curl -r -10 -o output.bin http://dom.com/file.txt # get last 10 bytes curl -r 0-9 -o output.bin http://dom.com/file.txt # get first 10 bytes
cvt 2560 1440 30 xrandr --newmode "2560x1440_30.00" 146.25 2560 2680 2944 3328 1440 1443 1448 1468 -hsync +vsync xrandr --addmode HDMI1 2560x1440_30.00 xrandr --auto --output HDMI1 --mode 2560x1440_30.00 --above eDP1
dd if=/dev/urandom of=XMB-file.dd bs=XM count=1 e.g. 10MB file dd if=/dev/urandom of=10M bs=10M count=1 dd if=/dev/urandom of=10M bs=1M count=10
Use PuSSH: http://sourceforge.net/projects/pussh/?source=dlp For example, generate random 10MB temp file to each computer: ./pussh -r lxbsp27[21-24] dd if=/dev/urandom of=/tmp/10M bs=1M count=10
Use TBrowser: root root [0] new TBrowser
.mlocate/updatedb after this locate should find your files
sensors-detect sensors
find . -executable -type f find -type f -executable -exec sh -c "file -i '{}' | grep -q 'x-executable; charset=binary'" \; -print
Add in CMakeLists.txt: set(CMAKE_BUILD_TYPE Debug) break davix_rw_test.cpp:40 run and then use next or step/s to walk through the interesting code. Other convenient commands: list, print <varname>, set <varname> = 3, finish Use gdb history, add file: ~/.gdbinit set history filename ~/.gdb_history set history save
set -x set +x
1st computer with network card eth0 (e.g. Ubuntu): ifconfig eth0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 2nd computer with network card p6p1 (e.g. SL6): ifconfig p6p1 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255 Also disable automatic network configurations: /etc/init.d/NetworkManager stop /etc/init.d/ntworking stop
xhost +local: beesu xeyes
apt-cache show rkhunter apt-cache show chkrootkit
/server add -network freenode irc.freenode.net /connect freenode /join -freenode #<your_channel>
screen -dmS "hax" screen -S "hax" -p 0 -X stuff "ls$(printf \\r)" screen -S "hax" -X screen screen -S "hax" -p 1 -X stuff "date$(printf \\r)"
kills () { for session in $(screen -ls | grep Detached | sed 's/ *\([0-9]\)\..*/\1/') do echo "Killing ${session}" screen -S "${session}" -X quit; done }
% Install: GNU Octave, version 3.6.4 (older ones won't probably work) plot(1:10);xlabel("example");ylabel("example");title("example"); fontsize=20; hx=legend('example');set(hx, "fontsize", fontsize) set([gca; findall(gca, 'Type','text')], 'FontSize', fontsize); set([gca; findall(gca, 'Type','line')], 'linewidth', 3); saveas(1, "presentation.jpg"); % Note! The Octave/gnuplot does not show the figure correctly but % the output is correct. Tested with gnuplot 4.4.
lvm help # Available lvm commands lvscan # List all logical volumes in all volume groups pvscan # List all physical volumes lvdisplay /dev/vg1 # Display information about a logical volume vgchange -a y vg1 # Activate your volume group mount /dev/vg1/root mnt # Mount a logical volume http://www.tldp.org/HOWTO/LVM-HOWTO/commontask.html
[ 942.771786] acer-wmi: Acer Laptop ACPI-WMI Extras [ 942.775138] Registered led device: acer-wmi::mail [ 943.000081] b43-phy0: Radio hardware status changed to ENABLEDThen just use it:
Start xterm with: "LC_CTYPE=fi_FI xterm" command. If this works, add in the ~/.bashrc file "LC_CTYPE=fi_FI" and your skandit/ääkkoset will probably work.
(prefer-coding-system 'latin-1) (set-keyboard-coding-system 'latin-1) (set-clipboard-coding-system nil) (set-terminal-coding-system nil)
SUBSYSTEM=="video4linux" ATTRS{vendor}=="0x1002" ATTRS{device}=="0x4374"Next write this info to udev rule, e.g. to /etc/udev/rules.d/10-local.rules (or any file in /etc/udev/rules.d/):
time_t now = time(NULL); struct tm *ptm = localtime(&now); char buffer[32]; strftime(buffer, 32, "%Y_%m_%d_%H_%M_%S", ptm); cout<<"time: "<<buffer<<endl;
(setq locale-coding-system 'utf-8) (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (set-selection-coding-system 'utf-8) (prefer-coding-system 'utf-8)Make lynx to use utf8:
ALTER TABLE event_referer ADD ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE event_referer ADD ip_from int(10) unsigned zerofill NOT NULL DEFAULT '0000000000';
AuthUserFile /home/users/ssheikki/.htpasswd AuthName "Secret area" AuthType Basic require user ssheikkiCreate passwd:
lspci -vvnn | grep 14e4 02:00.0 Network controller [0280]: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller [14e4:4727] (rev 01) lshw -C network *-network description: Network controller product: BCM4313 802.11b/g/n Wireless LAN Controller vendor: Broadcom Corporation http://elrepo.org/tiki/wl-kmod eth0: Broadcom BCM4727 802.11 Hybrid Wireless Controller 5.100.82.112
mkdir test; echo "koe">test/koe; echo "koe2">test/koe2 tar cvzf - test | openssl des3 -salt -k secretkey | dd of=encrypted_data dd if=encrypted_data |openssl des3 -d -k secretkey |tar xvzf -
cat >> filename_where_to_write.txt << EOF Here is text that should be appended to the file. Here is some more text. EOF
# Creating g++ -Wall -fPIC -c *.c gcc -shared -Wl,-soname,libsolinktest.so.1 -o libsolinktest.so.1.0 *.o # Linking g++ -Wall main.c -L. -lsolinktest -o main # Using LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./main
Add in /etc/ssh/sshd_config, e.g. in the end: GatewayPorts yes
Show all traffic to/from ips 10.40.*.* ip.addr==10.40.65.31/16 which is http protocol ip.addr==10.40.65.31/16 and http
top -p<PID> and see column RES
mkdir -p /mnt/tmpfs mount -o size=100M -t tmpfs none /mnt/tmpfs
yum remove yum-autoupdate OR /sbin/service yum-autoupdate stop /sbin/chkconfig --del yum-autoupdate
ldd ./main You can define missing ones e.g. like this: LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../path_of_missing_library/ ldd ./main
$ date +%s -d"Tue Jul 16 14:05:05 CEST 2013" 1373976305 $ date -d @1373976305 Tue Jul 16 14:05:05 CEST 2013
[3]+ Stopped my-program kill %3
echo "scale=2;2/3" | bc .66
seq 1 6 | sed ':x;N;s/\n/ /;tx' 1 2 3 4 5 6 seq 1 6 | sed -e :x -e 'N;s/\n/+/;tx' |bc 21
Last commited files: git log -1 --stat Changes in files: git log -p -1
There is two versions of rename: rename file- file2- * rename 's/file-/file2-/' *
dstat vmstat -n 1 iostat -x
strace strace -c strace -f -e trace=read,write
rm filethatdoesnotexist.txt || echo 2 0 || 1
rm filethatdoesnotexist.txt && (echo 2;echo 3) rm filethatdoesnotexist.txt && echo 2 && echo 3
User JAVA_HOME variable to point to the java version to be used: export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/ mvn -version export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/ mvn -version
export CC=clang export CXX=clang++ cmake .. make
tig git log --oneline --abbrev-commit --all --graph --decorate --color gitk
git status git checkout -b merging_feature git merge new_feature If failed: git reset --hard git checkout master git branch -D merging_feature If success: git checkout master git merge merging_feature
git status git branch savepoint git merge new_feature If failed: git reset --hard git reset --hard savepoint # OR SHA-1 hash git branch -d savepoint If success: git branch -d savepoint
Only filenames without path: find . -type f -printf "%s %f\n" With path: find . -type f -printf "%s %h%f\n"
g++ -pg main.c -o main ./main # Generates gmon.out file gprof -p -b ./main gmon.out
for i in {1..10}; do echo $i >> first.txt;done for i in {8..15}; do echo $i >> second.txt;done grep -x -f first.txt second.txt 8 9 10
ssh root@server.com 'tshark -f "port !22" -w -' | wireshark -k -i - ssh root@server.com tcpdump -iany -U -s0 -w - 'not port 22' | wireshark -k -i -
set([gca; findall(gca, 'Type','text')], 'FontSize', 16); set([gca; findall(gca, 'Type','line')], 'linewidth', 3); print -depsc2 figure.eps
g++ -g crasher.c ulimit -c unlimited ./a.out gdb ./a.out core.23531
ulimit -Sn ulimit -Hn
valgrind --tool=memcheck ./a.out valgrind --tool=memcheck --leak-check=yes ./a.out
clang++ --analyze test.cpp cppcheck --enable=all test.cpp splint test.c
git diff --name-only HEAD~3 HEAD git diff --name-only origin/HEAD HEAD git diff origin/HEAD HEAD file.txtku
git add -u git commit .
perl -MCPAN -e shell OR cpan Search programs: http://search.cpan.org/ m Email::Outlook::Message install Email::Outlook::Message
http://en.wikipedia.org/wiki/List_of_software_package_management_systems#Application-level_package_managers Perl - CPAN - http://en.wikipedia.org/wiki/Cpan PHP - Pear - http://en.wikipedia.org/wiki/PHP_Extension_and_Application_Repository Python - Pip - http://en.wikipedia.org/wiki/Pip_%28package_manager%29 Python - EasyInstall - http://en.wikipedia.org/wiki/EasyInstall Ruby - rubygems - http://en.wikipedia.org/wiki/RubyGems
grep -i 'scientific linux cern' /etc/redhat-release cat /etc/issue
- Compare index and HEAD git diff -cached - Add files by reviewing what you add: git add -p git add --patch - Use atomic commits ("commit per feature") - Commit message <= 50 chars - ref~1 (previous commit), ref^1 (previous parent) - Hunt bugs git bisect start # Start bug hunting git bisect bad # This commit is broken git bisect good v1.0 # This commit still worked git bisect reset # When bug was found (returns to intial state) - Hunt bugs automagic git bisect start HEAD v1.0 git bisect run test-error.sh # or make tests - Undo adding of file (after git add file.txt) git reset file.txt - Undo previous commit: git reset -soft HEAD^ # HEAD is moved back git reset HEAD^ # HEAD and index moved back git reset -hard HEAD^ # HEAD, index and working tree moved back - Undo hard reset (if it was mistake) git reflog git rebase <commit hash> - Clean repository for backup git reflog expire --expire=1.minute refs/heads/master git fsck --unreachable git prune git gc - Delete and rename brach git branch -d git branch -m - Create branch and move into it git checkout -b <branch> - Prefer rebasing over merging branches: avoids gluttering meta-data commits (you should not need to use normally git cherry-pick) - Good workflow might look like: # "we are on master" git checkout -b newfeature # "make changes" git commit -m "New feature" git rebase master git checkout master git merge newfeature git push origin master # if push fails (because somebody managed to change master) git pull --rebase - List branches git branch git branch -r # remote ones - Meld, remove, edit, reorder commits git rebase --interactive - Store changes away temporarily git stash save "Described changes" - Repository is for source code only (no binaries, distros, etc.)
ufw allow <port> ufw deny <port> ufw status
recordmydesktop -x 150 -y 120 -width 700 -height 500 -fps 30 --full-shots -o output.ogv Check the PID: ps aux | grep recordmydesktop | grep -v grep Record 50 minutes: sleep 3000 && kill -INT <PID>
Launch wireshark and use this filter: dns&&ip.src==<your_ip_address> Try to get some domain, e.g.: getent hosts aalto.fi There should be just one DNS request.
yum install nscd # A Name Service Caching Daemon (nscd). Check if DNS cache is working - should work like a dream. If like nightmare, asking lots of requests every 15 seconds, do: rm /var/db/nscd/hosts service nscd restart If still problems, enabling debug from /etc/nscd.conf and checking /var/log/nscd.log should be very useful.
pidof <application_name> e.g. pidof firefox
lsof -a -p 28290 or by anybody lsof | wc -l sysctl fs.file-nr
repoquery -l <package_name> e.g. repoquery -l NetworkManager-gnome
Check that you have right driver: lspci -vvnn | grep 14e4 Download Linux STA driver package: http://www.broadcom.com/support/802.11/linux_sta.php Install like this: http://www.broadcom.com/docs/linux_sta/README.txt If the compile fails, you might want to try: make API=WEXT sudo cp wl.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless sudo depmod -a modprobe wl For loading the module in startup, add: /etc/sysconfig/modules/kmod-wl.modules or simply echo modeprobe wl >> /etc/rc.local
sudo service NetworkManager status sudo service NetworkManager stop Add system tray to englihtenment to display nm-applet: 1) Open "Settings" -> "Modules" configuration window. 2) Click "Systray" and "Load". 3) In "Shelf Contents" window, click "Systray" and "Add Gadget" To start it automatically: Setting -> Apps -> Startup Applications and enable "Network Manager" on the System tab. Maybe worth knowing is also: nm-connection-editor
List available tests: ./unittests --gtest_list_tests Run specific test set: ./unittests --gtest_filter=T_UploadFacility.* Run specific test only: ./unittests --gtest_filter=T_UploadFacility.Callbacks
nc.traditional -v -l -p 5001 is same as socat - TCP-LISTEN:5001,crlf
apt-get install iperf Server side: iperf -s Server listening on TCP port 5001 TCP window size: 85.3 KByte (default) Client side: iperf -c picsurl.com Example output in server side: [ 4] local 78.47.65.195 port 5001 connected with 128.141.48.102 port 57633 [ ID] Interval Transfer Bandwidth [ 4] 0.0-10.1 sec 117 MBytes 96.8 Mbits/sec Example output in client side: [ 3] local 128.141.48.102 port 57633 connected with 78.47.65.195 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 117 MBytes 97.5 Mbits/sec You can also monitor packet losses: Server: iperf -s -u -i 1 Client: iperf -c picsurl.com -u -b 10m Example output server side: [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams [ 4] 0.0- 1.0 sec 11.7 MBytes 97.9 Mbits/sec 0.024 ms 70/ 8394 (0.83%) [ 4] 1.0- 2.0 sec 11.7 MBytes 97.9 Mbits/sec 0.123 ms 182/ 8511 (2.1%) [ 4] 2.0- 3.0 sec 11.7 MBytes 98.0 Mbits/sec 0.029 ms 202/ 8539 (2.4%) [ 4] 0.0-10.0 sec 117 MBytes 98.0 Mbits/sec 0.215 ms 1818/85257 (2.1%) [ 4] 0.0-10.0 sec 124 datagrams received out-of-order
cat /proc/<pid>/limits for example grep open /proc/3531/limits Max open files 1024 4096 files
ulimit -n <allowed_fid> e.g. ulimit -n 10000 ulimit -a
Singleton *Singleton::_s = NULL; Singleton *Singleton::instance() { static pthread_once_t once_control = PTHREAD_ONCE_INIT; pthread_once(&once_control, &Singleton::init); return _s; } void Singleton::init() { static Singleton s; _s = &s; } int main(void) { Singleton *s = Singleton::instance(); }
Singleton *Singleton::instance(){ static Singleton instance; return &instance; } int main(void) { Singleton *s = Singleton::instance(); }
Copy the git repository to new place/server, e.g. with scp: scp -r my_git_repository_to_be_moved my_username@my_server:/new/repo/dir/ Create .htaccess, e.g. echo "AuthName \"Secure Repo\" AuthType Basic AuthUserFile /home/users/username/.htpasswd require valid-user" > .htaccess and password htpasswd /home/users/username/.htpasswd johndoe Then it should work, e.g.: git clone https://johndoe:password@my_server/public/new/repo/dir
enlightenment_remote -desktop-lock If this does not work, make sure that you have DBus system module enabled: settings -> extensions -> modules -> system -> DBus Extension
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm emacs /etc/yum.repos.d/elrepo.repo # Enable repos sudo yum install kmod-hfs kmod-hfsplus
ulimit -c unlimited cat /proc/sys/kernel/core_pattern # Might be like this: |/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t e echo "core.%e.%p" > /proc/sys/kernel/core_pattern
http://rr-project.org/ rr record rr replay
for ((i = 0 ; i < 5 ; i++)); do echo ${i} done
Simulate: find . -name result.root -exec ls -laF {} \; Do it: find . -name result.root -exec rm {} \;
identify -verbose A0poster.pdf |grep "Print size" Print size: 35.4306x49.0139
$ ktutil ktutil: add_entry -password -p ssheikki@CERN.CH -k 1 -e arcfour-hmac-md5 ktutil: add_entry -password -p ssheikki@CERN.CH -k 1 -e aes256-cts ktutil: write_kt ssheikki.keytab $ kdestroy $ kinit -kt ssheikki.keytab ssheikki $ klist
# Simulate ps -ef | grep RemoteClient | awk '{print $2}' | xargs echo # Do it ps -ef | grep RemoteClient | awk '{print $2}' | xargs kill -9
sudo apt-get install xmacro xmacrorec2 > record.xmacro xmacroplay "$DISPLAY" < record.xmacro
g++ -O2 -Q --help=optimizers > o2options.txt g++ -O3 -Q --help=optimizers > o3options.txt diff o2options.txt o3options.txt
python -m cProfile -s time main.py # Note, that perf will NOT work (because python is interpreted and you # track what the interpreter is doing), e.g. perf record python main.py perf report
set -x set -vx # -v prints shell input lines
mplayer -cdrom-device /dev/sr0 cdda://X -cache 5000 e.g. mplayer -cdrom-device /dev/sr0 cdda://2 -cache 5000
Next line: grep -A1 keyword *.txt
sed -n '0~Np' your_file for i in {1..20};do echo $i>>i.txt;done sed -n '0~4p' i.txt 4 8 12 16 20
(global-whitespace-mode 1) See white space problems: M-x whitespace-report Note that whitespace problems are highlighted automatically (compared to your indenting settings).
Set depth of indenting: (setq-default c-basic-offset 4 tab-width 4) Indent with tabs: indent-tabs-mode t) Indent with space: (setq-default indent-tabs-mode nil) Change formating: Ctrl+x+h tabify untabify
Do only in private git repository: git add file.cc git commit --amend --no-edit git push github --force
Ctrl+h v c-mode-common-hook
In emacs23 paste this to an empty buffer and execute it (eval-buffer): (let ((buffer (url-retrieve-synchronously "http://tromey.com/elpa/package-install.el"))) (save-excursion (set-buffer buffer) (goto-char (point-min)) (re-search-forward "^$" nil 'move) (eval-region (point) (point-max)) (kill-buffer (current-buffer)))) In emacs24: (require 'package) (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) (package-initialize)
Either in .emacs or in .emacs.d/init.el: (require 'auto-complete) (require 'auto-complete-config) (ac-config-default) To autocomplete also structures: (require 'yasnippet) (yas-global-mode 1) And c/c++ headers: (require 'auto-complete-c-headers) ; define include dirs and hooks also (google how to) Change variable names in whole name: iedit
Ctrl+space M+w # Copy Ctrl+w # Cut Ctrl+y # Paste Ctrl+g # Quit command!!
Ctrl+x o # Switch to other window Ctrl+0 # Close current window Ctrl+1 # Open one window full Ctrl+2 # Horizontal cut Ctrl+3 # Vertical cut
M+Ctrl+s Ctrl+r # Search backward M+x occur M+x grep M+x rgrep
M+: (setq test '61) # test=66 Ctrl+h v # describe variable test Ctrl+e Ctrl+e # Evaluate test value
impatient-mode M+x httpd-start M+x impatient
yum install meld git mergetool git merge --help git checkout --theirs yourconflictingfile.txt git checkout --ours yourconflictingfile.txt
yum install bash-completion # yum in[TAB] info install
function test { sleep $1;echo "$1 done" } date test 3 & test 2 & wait date # should be 3 seconds difference to first date
cnt=0 while : ; do echo "$cnt" let "cnt+=1" if [ "$cnt" -gt "3" ];then break; fi done
$ echo "tes-"$'\n'"ti" tes- ti
1) cp sshpipe.sh /etc/rc.d/init.d/sshpipe 2) Make sure you have in your script: #!/bin/bash # chkconfig: 2345 95 20 # description: Ssh pipe # Opens ssh pipe # processname: sshpipe 3) Then execute: sudo chkconfig --level 2345 sshpipe on 4) Test sudo service sshpipe start
t = [x*2 for x in range(1,10) if x>2] # [6, 8, 10, 12, 14, 16, 18] r = filter(lambda x: x % 4 == 0, t) # [8, 12, 16]
class Example(object): def __init__(self, name): self.name = name def __repr__(self): return self.name def printName(self): print self.name print Example("test").name print Example("test") Example("test").printName()
g++ -pthread -g -std=c++0x -W -Wall -Wextra -pedantic main.c valgrind --tool=helgrind ./a.out
Configure: /etc/pdns-recursor/recursor.conf Especially: allow-from=127.0.0.1 disable-packetcache=yes forward-zones-recurse= .=your_outside_dns_ip1, .=your_outside_dns_ip2 Add in /etc/resolv.conf nameserver 127.0.0.1 Start: pdns_recursor Monitor: rec_control get-all | grep -e ^cache-hits -e ^cache-misses
git add -p <filename> # Choose the chunks to commit: y/n git commit
lscpu x86info # more detailed but not standard
function handle_sigint() { for subpid in `jobs -p`; do kill ${subpid} done } trap handle_sigint SIGINT
git branch --merged git branch -d your-merged-branch git push github :your-merged-branch # Github specific
git checkout -b devel-integ git merge not-yet-merged-branch not-yet-merged-branch2
nohup ./test_program nohup ./test_program > foo.out 2> foo.err < /dev/null &>
ps -e -T -o pid,ppid,cmd > first.txt ./your_program_run ps -e -T -o pid,ppid,cmd > second.txt diff first.txt second.txt
(gdb) define fc Type commands for definition of "fc". End with a line saying just "end". >finish >c >end
load_threshold=0.1 boxload=`uptime | sed 's/.* load average: \([^,]*\).*/\1/'` overloaded=`bc <<< "${boxload}>${load_threshold}"` if [ "${overloaded}" -eq "1" ]; then echo "Overloaded." fi
sestatus setenforce permissive
nscd -g If your "cache hits on positive entries" is always zero, change /etc/nscd.conf: shared hosts no to see if it is working. Shared = yes means that clients search the nscd cache directly and do not go through daemon.
For example 'a' with 'b' in ${mywar}: newmyvar=${myvar//a/b}
yum repolist all yum-config-manager --enable <the_repo_you_want>
git stash list git stash show -p stash@{0} See changes for certain file git diff stash@{0}^! -- <yourfile> git checkout stash@{0} -- <yourfile> git show stash@{0}:<path/yourfile> > newfile
g++ main.c -o myprogram -lprofiler CPUPROFILE=/tmp/profile ./myprogram pprof --text ./myprogram /tmp/profile pprof --gv ./myprogram /tmp/profile Example output: Total: 350 samples 90 25.7% 25.7% 92 26.3% add 71 20.3% 46.0% 227 64.9% method1 66 18.9% 64.9% 69 19.7% multiply 48 13.7% 78.6% 48 13.7% add2 45 12.9% 91.4% 45 12.9% multiply2 30 8.6% 100.0% 123 35.1% method2Shows that method1 took 64.9% of the cpu and method2 35.1%.
valgrind --tool=callgrind <yourprogram> # Monitor what is happening online while [ 1 ]; do callgrind_control -b;done qwhile [ 1 ]; do clear; callgrind_control -b; sleep 0.1;done Example output: Frame: Backtrace for Thread 1 [ 0] multiply(float) (5419396 x) [ 1] method1() (1 x) [ 2] main (1 x)
tc qdisc del dev eth0 root # Return to normal tc qdisc add dev eth0 root handle 1: prio tc qdisc add dev eth0 parent 1:1 handle 2: netem delay 100ms tc filter add dev eth0 parent 1:0 protocol ip pref 55 handle ::55 u32 match ip dst IP.IP.IP.IP flowid 2:1
tc qdisc del dev eth0 root tc qdisc add dev eth0 root handle 1: htb tc class add dev eth0 parent 1: classid 1:6 htb rate XXkbps tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip dst IP.IP.IP.IP flowid 1:6
ps -p <PID> -o etime= ps -p 22488 -o etime= 01:33
g++ -E main.cc # Outputs to stdout # See also -S (assembler code)
apt-get install zsh chsh -s /bin/zsh curl -L http://install.ohmyz.sh | sh # reboot echo $SHELL
Ctrl-Space # Select starting point # Move to other end of the area M-;
strace -c # count system calls # e.g. futex:es (fast userspace mutex)
netstat # Proto Recv-Q Send-Q Local Address Foreign Address State # tcp 0 0 ssheikkicga.cern.ch:ssh pb-d-128-141-48-87.ce:37832 ESTABLISHED # Check the Send-Q
python -m pdb program_name.py b 666 r
mkdir w for i in `find . | grep -i jpg$`; do k=`echo $i | sed 's/\(.*\)\/.*/\1/'` && mkdir -p w/$k && cp $i w/$k/; done
grep cgroup /proc/mounts # Check where mounted cat /proc/cgroups # List available cgroups cgcreate -g blkio:/iothrottle ll /dev/dm-0 # Check disk major and minor number e.g. "253, 0" cgset -r blkio.throttle.read_iops_device="253:0 2" iothrottle echo $$ # get the PID, e.g. 6666 echo 6666 > /cgroup/blkio/iothrottle/tasks # Note! ext3 is mounted in default with "data=ordered", this # means that writes are flushed to disk in the order they are # done, meaning slowest will slow down others also
dd if=/dev/zero bs=1M count=1000 | pv > test.txt 0.977GB 0:00:09 [ 107MB/s] [ <=> ]
gcc -Wall -fprofile-arcs -ftest-coverage main.c # creates main.gcno ./a.out # creates main.gcda ./a.out # updates main.gcda gcov main.c # creates main.c.gcov, which shows how many times # each line of code was executed during (./a.out)s
cp /home/nemo/.local/share/system/privileged/Calendar/mkcal/db db sqlite3 db sqlite> .table Alarm Components Recursive Attendee Customproperties Timezones Calendars Rdates Version sqlite> SELECT Name FROM Calendars; Default Birthdays sqlite> SELECT count(Summary) FROM Components; 574
# 10k downloads with 400 parallel requests ab -n 10000 -c 400 http://web-page.com/dir/file.html
$ echo File-{a,b,c}.txt File-a.txt File-b.txt File-c.txt
wc -c < yourfile.txt stat -c %s yourfile.txt
pgrep -l -f example # List the processes that would be killed pkill -f example # Kill the processes
parted -l # If, and only if, you get: "unrecognised disk label" parted /dev/sdX # e.g. sdb (parted) mklabel gpt # e.g. msdos cannot handle 8TB (parted) mkpart primary 0% 100% (parted) print Disk /dev/sdb: 8002GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 8002GB 8002GB primary
veracrypt --text -v --create /dev/sdb1 # E.g. AES + SHA-512, might take days veracrypt --text -v --filesystem=none --slot=1 /dev/sdb1 # Add maybe --mount-options=nokernelcrypto mkfs.ext4 -m0 -T largefile /tmp/.veracrypt_aux_mnt1/volume tune2fs -l /tmp/.veracrypt_aux_mnt1/volume # See what was done mount -o loop /tmp/.veracrypt_aux_mnt1/volume /mnt /tmp/.veracrypt_aux_mnt1/volume 7.3T 51M 7.3T 1% /mnt
https://en.wikipedia.org/wiki/Magic_SysRq_key echo 1 > /proc/sys/kernel/sysrq Alt-PrintScreen-s # Sync filesystems Alt-PrintScreen-b # Reboot machine
Jira + Agile plugin (or redmine) # Bug and feature tracking + SCRUM/KANBAN Jenkins + Docker + gtest + cmake # CI an testing git + pull requests # Code review
$ fs la public Access list for public is Normal rights: system:administrators rlidwka system:anyuser rl ssheikki rlidwka $ fs sa private system:anyuser none # Anyuser cannot do anything $ fs la private Access list for private is Normal rights: system:administrators rlidwka ssheikki rlidwka
compizconfig-settings-manager Step 1/2) Desktop -> Ubuntu Unity Plugin Open Switcher tab and make key to start the switcher and key to start the switcher in reverse disabled. Step 2/2) Window Management -> enable Static Application Switcher Open Application Switcher and change key bindings of "Next Window (All windows)" to Alt-Tab and "Prev window (All windows)" to Shift-Alt-Tab.
hwloc-ls --of ascii lstopo --of png > topo.png
xterm -fa default -fs 10 xterm -fa default -fs 10 -e "ssh lakka.kapsi.fi"
sudo apt-get install ltsp-server-standalone sudo ltsp-build-client # Configure dhcp and boot client server with PXE.
In the server: ssh -N -D 0.0.0.0:4241 ssheikki@machines-whose-network-you-want-to-use.com
1) Frequency scaling, e.g. 2.9GHz: echo 2900000 | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq 2) RAPL, e.g. 66W power_gov -r POWER_LIMIT -d PKG -s 66 3) cpulimit, e.g. 66% limit for PID 6666: cpulimit -l 66 -p 6666
themachine$ sudo iptables -t nat -A OUTPUT -p all -d 192.168.111.11 -j DNAT --to-destination 127.0.0.1 privateVM$ ssh -v -N -R 49490:localhost:22 -2 themachine themachine$ ssh -p 49490 192.168.111.11
synclient TapButton2=2 $ synclient | grep -i button TapButton1 = 1 TapButton2 = 2 TapButton3 = 3
$ dig cern.ch txt | grep -i spf cern.ch. 3600 IN TXT "v=spf1 a:cernmx11.cern.ch a:cernmx12.cern.ch a:cernmx13.cern.ch a:cernmx14.cern.ch a:cernmx15.cern.ch ?all" # ?Neutral, ~Softfail, -Fail, +Pass
perf record -F 99 -a -g -- sleep 300 perf report --sort=comm # Analysis
sysbench --test=cpu --num-threads=1 --cpu-max-prime=99999 run # total time: 215.4861s
echo "test=1" > demo.txt sed -i.bak 's/\(test=\).*/\1newparam/' demo.txt cat demo.txt test=newparam ls demo.txt* demo.txt demo.txt.bak
#!/bin/bash nsamples=1 sleeptime=0 pid=$1 for x in $(seq 1 $nsamples); do gdb -ex "set pagination 0" -ex "thread apply all bt" -batch -p $pid sleep $sleeptime done | \ awk ' BEGIN { s = ""; } /^Thread/ { print s; s = ""; } /^\#/ { if (s != "" ) { s = s "," $4} else { s = $4 } } END { print s }' | \ sort | uniq -c | sort -r -n -k 1,1 Example output: 291 pthread_cond_wait 15 select
perf record -F 100000 <yourbinary> perf report | grep <libThatYouAreInterested> Example output: 0.06% xrootd libXrdServer.so.2.0.0 [.] XrdOfsFile::write 0.03% xrootd libXrdServer.so.2.0.0 [.] XrdOssAioWait
# apt install postfix # cat /etc/postfix/virtual # Associate to external email and to local account @seppoheikkila.com ssheikki ssheikki@kapsi.fi # grep -e my -e virtual /etc/postfix/main.cf myhostname = mail.seppoheikkila.com virtual_alias_domains = seppoheikkila.com virtual_alias_maps = hash:/etc/postfix/virtual # cat /etc/mailname seppoheikkila.com # postmap /etc/postfix/virtual # Run to update the virtual info
# apt install fail2ban # cat /etc/fail2ban/jail.local [DEFAULT] ignoreip = 127.0.0.1/8 217.30.184.0/24 128.141.232.250/24 46.127.0.0/16 bantime = 600 maxretry = 3 destemail = ssheikki@kapsi.fi sender = seppo@seppoheikkila.com sendername = seppo mta = sendmail action = %(action_mwl)s # dpkg -S /usr/sbin/sendmail postfix: /usr/sbin/sendmail
# grep PermitRoot /etc/ssh/sshd_config PermitRootLogin no # cat /etc/hosts.allow | grep sshd sshd : 127.0.0.1/8 sshd : 217.30.184.0/24 sshd : 128.141.232.0/24 sshd : 46.127.0.0/16 # cat /etc/hosts.deny | grep sshd sshd: ALL
links -socks-proxy proxyurl:proxyport websiteurl:websiteport e.g. links -socks-proxy localhost:49495 10.5.0.13:8000
sudo apt install xbacklight xbacklight -get xbacklight -set 1
date +%s.%3N date +%s.%6N date +%s.%9N
http://builtwith.com/ssheikki.kapsi.fi http://guess.scritch.org
sudo apt-add-repository ppa:relan/exfat sudo apt-get update sudo apt-get install fuse-exfat
All you need a OpenSSH server where to connect: ssh -C -D 1080 <your_server> Then set your browser SOCKS host 127.0.0.1 and port 1080.
Ctrl+w # delete from cursor to start of word Ctrl+u # delete from cursor to start of line Ctrl+] char # Move cursor to next "char"
oggCut -s start_time -e end_time old.ogv new.ogv oggCut -s 590000 -e 1315000 old.ogv new.ogv
$ stat test.txt File: `/tmp/test.txt' Size: 5 Blocks: 8 IO Block: 4096 regular file Device: 811h/2065d Inode: 674650 Links: 1 Access: (0664/-rw-rw-r--) Uid: ( 1000/ssheikki) Gid: ( 1000/ssheikki) Access: 2014-06-28 11:03:39.775420193 +0200 Modify: 2014-06-28 11:00:46.727426532 +0200 Change: 2014-06-28 11:06:33.739413820 +0200 Birth: -
debugfs /dev/dm-0 debugfs: cat <23601012> test debugfs: imap <674650> Inode 674650 is part of block group 82 located at block 2622677, offset 0x0900 debugfs: stat <674650> Inode: 674650 Type: regular Mode: 0755 Flags: 0x80000 Generation: 3333919195 Version: 0x00000000:00000001 User: 1000 Group: 1000 Size: 5 File ACL: 0 Directory ACL: 0 Links: 1 Blockcount: 8 Fragment: Address: 0 Number: 0 Size: 0 ctime: 0x53ae8599:b04a3cf0 -- Sat Jun 28 11:06:33 2014 atime: 0x53ae84eb:b8dfe484 -- Sat Jun 28 11:03:39 2014 mtime: 0x53ae84d8:ed53ab40 -- Sat Jun 28 11:03:20 2014 crtime: 0x53ae843e:ad6e9790 -- Sat Jun 28 11:00:46 2014 Size of extra inode fields: 28 EXTENTS: (0):2705974 debugfs: ex <674650> Level Entries Logical Physical Length Flags 0/ 0 1/ 1 0 - 0 2705974 - 2705974
If X is e.g. 4: Offending key for IP in /home/user/.ssh/known_hosts:4 sed -i '4d' ~/.ssh/known_hosts
pkcon search name nano pkcon install nano pkcon install jolla-fileman pkcon install zypper pkcon install python pkcon install gcc gcc-c++
ssu ar mer-tools ssu ur pkcon refresh pkcon install less zypper ar -f http://sailfish.openrepos.net/basil/personal-main.repo rpm --import http://sailfish.openrepos.net/openrepos.key zypper refresh zypper install harbour-warehouse zypper ar -f http://sailfish.openrepos.net/NielDK/personal-main.repo rpm --import http://sailfish.openrepos.net/openrepos.key zypper refresh # Install now software, e.g. wget, through warehouse app
# @N900 osso-addressbook-backup -e contacts.vcs dos2unix contacts.vcs # This is must! # @Jolla: Replace unsupported NOTE field e.g. with ORG: sed 's/NOTE:/ORG:/' contacts.vcs > contacts.vcf # Use jolla-fileman to open the contacts.vcf
1) Contacts: After backup, found in /home/nemo/.vault/People/data/all.vcf 2) Photos: Copy directly from /home/nemo/Pictures/ 3) Videos: Copy directly from /home/nemo/Videos/ 4) Calendar: config davCal account, sync to ownCloud (e.g. https://box.cern.ch/), download ics file OR Copy /home/nemo/.local/share/system/privileged/Calendar/mkcal/db 5) Copy other stuff from .vault just in case: tar cvf ../vault.tar A* B* M* P* scp nemo@<IP>:vault.tar .
convert <your_image> -format "%[mean]" info: convert <your_image> -colorspace hsb -resize 1x1 txt:-
mkfs.exfat -n <volume_label> /dev/sddX fsck.exfat /dev/sddX # Check all is ok exfatfsck 1.0.1 Checking file system on /dev/sdd1. File system version 1.0 Sector size 512 bytes Cluster size 128 KB Volume size 931 GB Used space 31 MB Available space 931 GB Totally 0 directories and 0 files. File system checking finished. No errors found.
updatedb -l 0 -o /home/ssheikki/mlocate.db -U /home/ssheikki/ export LOCATE_PATH="/home/ssheikki/mlocate.db" locate whateveryouwant
- Download pictures with iTunes to MacOS. If you need to mass delete pictures from iPhone, use Image Capture from MacOS. - Install "My Contacts Backup" app to the iPhone (free). It emails you vcf file of your contacts. - Sms from backup: sqlite3 3d0d7e5fb2ce288813306e4d4636395e047a3d28 " SELECT chat.chat_identifier, message.is_from_me, datetime(message.date + 978307201, 'unixepoch') as date, message.text FROM chat JOIN chat_message_join on chat.ROWID = chat_message_join.chat_id JOIN message on message.ROWID = chat_message_join.message_id order by message.date" > sms.txt - Notes from iTunes backup: sqlite3 ca3bc056d4da0bbf88b5fb3be254f3b7147e639c "select zcontent from znotebody" > notes.txt
Choose one puppet master and install: $ sudo apt-get install puppetmaster In all the others machines (clients): $ sudo apt-get install puppet $ echo "<puppetmaster-ip> puppet" >> /etc/hosts $ puppet agent -t Then again puppet master machine: $ echo "<puppetclient-ip> <puppetclient-name>" >> /etc/hosts $ puppet cert sign <puppetclient-name> Then again in clients: $ puppet agent -t
After configuring VLAN IDs to ports in the switch: 1) apt-get install vlan 2) modprobe 8021q 3) configure /etc/network/interfaces auto <interface>.<vlanid> e.g. "auto em1.1000" auto em1.1001 iface em1.1001 inet static address 192.168.12.166 netmask 255.255.255.0 network 192.168.12.0 broadcast 192.168.12.255 4) ifup em1.1001
Assumptions: 192.168.2.0/24 = internal network, em2 = external network (internet) iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o em2 -j MASQUERADE iptables -A FORWARD -s 192.168.2.0/24 -o em2 -j ACCEPT iptables -A FORWARD -d 192.168.2.0/24 -m state --state ESTABLISHED,RELATED -i em2 -j ACCEPT
After cloud backup, e.g. Dropbox: 1) Contacts: tmp/People/data/all.vcf 2) Calendar: tmp/Calendar/data/all.ics 3) Photos: Copy directly from /home/nemo/Pictures/ 4) Videos: Copy directly from /home/nemo/Videos/ 5) Recordings: Copy directly from /home/nemo/Documents/Recordings
sudo apt-get install fswebcam fswebcam --jpeg 80 -S 10 image.jpg fswebcam --jpeg 80 -D 3 -S 10 image.jpg # For some webcams
convert -delay 20 -loop 0 *.jpg out.gif gifsicle --resize 640x out.gif > small.gif
export CVSROOT=:local:/path/to/your/cvs_root cvs co <yourProjectName> cvs log
git clone https://github.com/haikarainen/light.git ./autogen.sh && ./configure && make && make install sudo /home/ssheikki/.light/light -S 1 # Set minimum brightness sudo /home/ssheikki/.light/light -A 5 # Increase brightness sudo /home/ssheikki/.light/light -U 5 # Decrease brightness
Put in the Firefox address bar: about:config layout.css.devPixelsPerPx to 1.4 (from -1)
sudo nano /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"
Use gnome-tweak-tool to disable suspend Power -> Don't suspend on lid close => On
sudo echo 0 > /sys/class/leds/tpacpi\:\:kbd_backlight/brightness sudo echo 1 > /sys/class/leds/tpacpi\:\:kbd_backlight/brightness sudo echo 2 > /sys/class/leds/tpacpi\:\:kbd_backlight/brightness
audacity Transport -> Timer Record (record for one hour for example) Effect -> Amplify (clipping enabled and max amplification) View -> Fit in Window (now you should see the pattern)
masterpdfeditor4 https://code-industry.net/free-pdf-editor/
echo "@reboot /root/my_script.sh" > cron.in crontab -i cron.in
interface eth0 static ip_address=192.168.0.10/24 static routers=192.168.0.1 static domain_name_servers=192.168.0.1 metric 666 # Note! Interface with lower metric is preferred
convert -delay 20 -loop 0 *.jpg out.gif convert -quality 100 *.jpg out.mpeg
- auto white balance - levels, pick gray point - rotate/perspective/etc
$ touch .pine-passfile $ grep kapsi .pinerc inbox-path={mail.kapsi.fi}inbox folder-collections=mail.kapsi.fi {mail.kapsi.fi:993/ssl}[]
Multiple GNOME terminals in one window: terminator
apt-get install python-vcstool vcs pull -n vcs push -n
ifmetric wlan0 0 The network connection defaults to the connection with the lower number.
$ cat ~/.emacs (defun my-c++-mode-hook () (setq c-basic-offset 4) (c-set-offset 'substatement-open 0)) (add-hook 'c++-mode-hook 'my-c++-mode-hook)
composite -blend 50 num1.jpg num2.jpg tmp.jpg composite -blend 66 tmp.jpg num3.jpg blended.jpg
sudo nmcli device wifi connect YOURESSID password YOURPASSWORD # Note, you might need to add/del routers also
Settings panel -> Files -> File Manager -> Behavior -> Icons on desktop Settings panel -> Files -> File Manager -> Device -> Show device icons on desktop
xrandr --auto --output HDMI-2 --mode 1920x1080 --right-of eDP-1 xrandr --output HDMI-2 --off
vcs status -s vcs status -s --repos
https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual Simply compile your program with -fsanitize=thread and link it with -fsanitize=thread. To get a reasonable performance add -O2. Use -g to get file names and line numbers in the warning messages.
Run in the directory where you want to do the rename. convmv -r -f windows-1252 -t UTF-8 . The above does not do the rename yet (dry run). Add --notest to do the real.
# Encrypt disk cryptsetup luksFormat /dev/sdc1 --align-payload 2048 cryptsetup luksHeaderBackup --header-backup-file header_file.txt /dev/sdc1 cryptsetup luksOpen /dev/sdc1 disk-enc mkfs.ext4 -m0 /dev/mapper/disk-enc cryptsetup luksClose disk-enc # Basic usage cryptsetup luksOpen /dev/sdc1 disk-enc mount /dev/mapper/disk-enc mnt umount mnt cryptsetup luksClose disk-enc
# clockwise: pdftk input.pdf cat 1-endeast output output.pdf # anti-clockwise: pdftk input.pdf cat 1-endwest output output.pdf
while read line; do echo $line done <input_file.txt
Ctrl + A and : hardcopy -h <your_filename>
sudo apt install keepassx scp keepassx_database.kdbx nemo@jolla:Documents/ownkeepass/
Use Image Capture from MacBook Air to Import All pictures and videos to some folder, e.g. "Movies". A full size image is are 3264 x 2448, taking around 2MB.
sudo apt install bluetooth bluez bluez-tools rfkill blueman pavucontrol sudo rfkill list # Check that bluetooth is not blocked sudo rfkill unblock bluetooth # Unblock bluetooth, if needed sudo service bluetooth start # Start bluetooth service sudo blueman-manager # Pair devices pavucontrol # Set bluetooth headset as output device
dirname <full_path> basename <full_path>
alias cpwd='pwd | xargs echo -n | xclip -selection clipboard' cpwd # and then paste (Ctrl+v) e.g. in web browser
ssh-keygen -b 2048 -t rsa -f id_rsa_mykey # You can use this key for specific server by adding in # ~/.ssh/config Host gitserv Hostname remote.server.com IdentityFile ~/.ssh/id_rsa_mykey IdentitiesOnly yes
grep pam_xau /etc/pam.d/su # Add the line below to this file session optional pam_xauth.so # Then just login; "su desired_user"
Setup > Config search for "Pruning Rule" and choose: "don't rename, don't delete"
git checkout -b my_new_branch git add -p git commit -m "my feature" git push origin my_new_branch
nmcli dev status nmcli con show Ethernet nmcli con mod Ethernet ipv4.addresses 192.168.0.102/24 ip a nmcli dev disconnect enp8s0; nmcli con up Ethernet
/usr/NX/bin/nxclient -admin # To where you want to connect /usr/NX/bin/nxplayer # From where you want to connect
git checkout -b fix-new-feature git add -p git commit -m "Fix: feature works" git push git checkout master git pull git branch --merged git branch -d fix-new-feature
find . -type f -size 1w -exec cat {} \; # to delete them find . -type f -size 1w -delete
find . -type f -empty # to delete them find . -type f -empty -delete
apt install pbzip2 tar cvf my.tar.bz2 --use-compress-program=pbzip2 folder/
nmap -sL 192.168.1.0/24 Maybe more reliable (but slower): subnet=192.168.1;for i in {1..254};do ping -W1 -c1 ${subnet}.$i &>/dev/null && echo ${subnet}.$i;done
zip -e my_archive.zip my_files* unzip my_archive.zip
https://waynemorrison.com/software/vcal vcal <your_vcal_file> # event start: 2019-09-12 10:00 FLE Standard Time # event end: 2019-09-12 13:00 FLE Standard Time # summary: Kick-off meeting
In Volvo: - Go to "Paired phones" menu. - Press "exit" button on steering wheel, to display "phone menu". - Select "Phone settings" and "Discoverable", this makes car discoverable for 3 minutes. In Jolla: - Search for Bluetooth devices, you should find "My Volvo Car". - Volvo asks for keypair, write e.g. 0000. - Press the same keypair in the Jolla. [src] https://www.youtube.com/watch?v=jdNf7BBknPA
# Encrypt. Put encryption password to yourpassword.txt echo -n "yourpassword" > yourpassword.txt openssl enc -aes-256-cbc -in yourfile.txt -out yourfile.txt.openssl -pass file:yourpassword.txt # Decrypt openssl enc -aes-256-cbc -d -in yourfile.txt.openssl -out yourfile.txt
1) Make Dropbox backup: sailfish_backup_XXX.tar.gz 2) Copy pictures and videos mount_jolla ~/mnt cdate=`date +%Y_%m_%d` mkdir -p ${cdate}_Jolla_Pictures cp -p -r ~/mnt/Pictures ${cdate}_Jolla_Pictures/Pictures cp -p -r ~/mnt/Videos/Camera ${cdate}_Jolla_Pictures/Videos
# apt install isc-dhcp-server # grep INTER /etc/default/isc-dhcp-server INTERFACES="enx503eaa9f81be" # grep -v "#" /etc/dhcp/dhcpd.conf | sed '/^$/d' ddns-update-style none; option domain-name "local"; default-lease-time 600; max-lease-time 7200; INTERFACES="enx503eaa9f81be"; authoritative; log-facility local7; subnet 192.168.42.0 netmask 255.255.255.0 { option routers 192.168.42.1; range 192.168.42.10 192.168.42.100; option domain-name-servers 8.8.8.8; } # ifconfig enx503eaa9f81be 192.168.42.1 # systemctl start isc-dhcp-server.service # systemctl status isc-dhcp-server.service
ip link set enx503eaa9f81be mtu 9014 sysctl -w net.core.rmem_max=10485760 sysctl -w net.core.rmem_default=10485760
"Hit ; (select) then t (text) then a (all text), and then your search phrase."
ffmpeg -i video_in.mkv -vcodec libx264 -strict -2 video_out.mp4 mediainfo video_out.mp4 # Optional, check what you have
E.g. codemeter $ apt-cache rdepends codemeter codemeter Reverse Depends: cvb-camerasuite $ aptitude -v --show-summary=all-packages why codemeter Packages requiring codemeter: cvb-camerasuite P: codemeter
git log --oneline # To get commit hashes git revert <unwanted commit hash>
# Terminal with black background and bit bigger font xterm -fg white -bg black -fa default -fs 12 # Connect to a server xterm -fg white -bg black -fa default -fs 12 -e ssh yourserver.com # Right click the shelf and configure shelf content, especially systray
hip=192.168.0.102 sdir="/home/ssheikki/Downloads/c h/" #sdir="/home/ssheikki/.config/unity3d/srylain Inc_/Clone Hero" rsync --protect-args --progress -a "${sdir}" ssheikki@${hip}:"${sdir}" rsync --protect-args --progress -a ssheikki@${hip}:"${sdir}" "${sdir}"
echo $XDG_SESSION_TYPE #x11 xinput list # ⎜ ↳ SYNA2393:00 06CB:7A13 Touchpad id=11 [slave pointer (2)] xinput --list-props 11 | grep Tap # libinput Tapping Enabled (310): 0 xinput --set-prop 11 310 1 xinput --list-props 11 | grep Middle # libinput Middle Emulation Enabled (328): 0 xinput --set-prop 11 328 1 $ cat /etc/X11/xorg.conf.d/30-touchpad.conf Section "InputClass" Identifier "touchpad" Driver "libinput" MatchIsTouchpad "on" Option "Tapping" "on" Option "TappingButtonMap" "lmr" EndSection # Install synaptics in parallel sudo apt install xserver-xorg-input-synaptics-hwe-18.04
alias youtube-dl-audio='youtube-dl --ignore-errors --output "%(title)s.%(ext)s" --extract-audio --audio-format mp3' youtube-dl-audio https://<youtube_url>
inode=`stat -c %i FILETOCHECK.txt` && sudo debugfs -R "stat <${inode}>" /dev/nvme0n1p2 | grep -i crtime crtime: 0x5ca4a2b0:df7a3b24 -- Wed Apr 3 15:10:24 2019
git commit -m "Change" # Ooops! Forgot to pull first git reset --soft HEAD~1 git pull git commit -m "Change" git push
printf 'GET /index.php HTTP/1.1\r\nHost:www.mielipiteet.fi\r\n\r\n' | nc -v www.mielipiteet.fi 80 | grep charset # Remember HTTP header overrides the META header!
- Check mysql server setting: mysql> SELECT SCHEMA_NAME 'database', default_character_set_name 'charset', DEFAULT_COLLATION_NAME 'collation' FROM information_schema.SCHEMATA; - Check php default encoding: grep default_charset /etc/php/7.4/apache2/php.ini | grep -v "^;" - Check apache2 default encoding: less /etc/apache2/conf-enabled/charset.conf
- Make sure that there is reverse DNS defined, e.g. in Hetzner webpage: nslookup 95.217.158.247 - Make sure that you have valid ipv6 address: ifconfig # In your server ping6 2a01:4f9:c010:7005::1 # Outside your server - Postfix should reply from port 25 nc 95.217.158.247 25 220 yourdomain.com ESMTP Postfix (Ubuntu) - Create SPF record for domain to authenticate email Create DNS TXT record like this (e.g. in joker.com): "v=spf1 ip4:95.217.158.247 ip6:2a01:4f9:c010:7005::1 -all" you can verify that the record exists: nslookup -type=txt yourdomain.com - Check that email is sent from the domain you want $ grep myorigin /etc/postfix/main.cf myorigin = /etc/mailname $ cat /etc/mailname yourdomain.com - When sending email, make sure X-Postfix-Sender is same as From sender, e.g. in php use "-f" additional parameter: mail($mailto, $subject, $text, "From: admin <" . $from . ">", "-f $from");
sudo apt install datamash printf '1.2\n2\n4\n' > numbers.txt cat numbers.txt | sed 's/\./,/' | datamash mean 1 min 1 max 1 | sed 's/,/\./g'
sudo fallocate -l 2G /swapfile # 1-2 x actual memory sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile sudo echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab sudo echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf # 10=server
curl -i -X POST -H "Content-Type: multipart/form-data" \ -F 'lahetys=Send' \ # This is upload button name -F "tiedosto=@testi2.txt" \ # This is file to upload http://www.example.com/upload.php # This is your domain
# Open pipe ssh -p49592 -o ServerAliveInterval=5 -o ServerAliveCountMax=1 -N -R 49599:localhost:22 username@exampleserver.com # Copy files (start inside screen on a remote server) rsync --partial -e "ssh -o ServerAliveInterval=5 -p49599" yourfiles* username@exampleserver.com:
git checkout new_branch git merge --strategy=ours master git checkout master git merge new_branch
about:config layout.css.devPixelsPerPx = 2 toolkit.legacyUserProfileCustomizations.stylesheets = True Check with "about:profiles" what is your profile directory and make file: $ cat ~/.mozilla/firefox/qx.default-release/chrome/userChrome.css @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */ * { font-size: 14px !important; } /* exception for badge on adblocker */ .toolbarbutton-badge { font-size: 8px !important; }