This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| watch --difference=cummulative --interval=1 '(echo device read_IOs read_merges read_sectors read_ticks write_IOs write_merges write_sectors write_ticks in_flight io_ticks time_in_queue; for file in /sys/block/*/stat; do echo -n $file; cat $file; done) | column -t' | |
| # OUTPUTS: | |
| #device read_IOs read_merges read_sectors read_ticks write_IOs write_merges write_sectors write_ticks in_flight io_ticks time_in_queue | |
| #/sys/block/dm-0/stat 116962 0 2212746 314096 7705653 0 150218536 609670232 0 644428 610921004 | |
| #/sys/block/dm-1/stat 116479 0 2208882 313324 7686986 0 150218536 609676068 0 644616 611418072 | |
| #/sys/block/dm-2/stat 302 0 2416 780 0 0 0 0 0 148 780 | |
| #/sys/block/sda/stat 91181 26273 2217246 74876 7314854 388030 150261802 16954364 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if xdotool search --class "mpv"; then | |
| echo "process exists" | |
| scbc=$(zenity --entry --title="Youtube" --text="searching for:") | |
| [[ "$?" != "0" ]] && exit 1 | |
| echo "{ \"command\": [\"loadfile\", \"ytdl://ytsearch100:$scbc\" ] }" | socat - /tmp/mpvsocket | |
| else | |
| echo "process not exists" | |
| coproc mpv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // -*- coding:utf-8-unix; mode:c; -*- | |
| // | |
| // get the active window on X window system | |
| // | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <locale.h> | |
| #include <X11/Xlib.h> // `apt-get install libx11-dev` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scbc=$(zenity --entry); sqlite3 ~/Downloads/dictionarytr-en.db "SELECT load_extension('/usr/lib/sqlite3/pcre.so'); SELECT translate.id as id,english.word as word_en,turkish.word as word_tr,type.name as type,category.name as category FROM translate INNER JOIN english ON translate.english_id = english.id INNER JOIN category ON translate.category_id = category.id INNER JOIN type ON translate.type_id = type.id INNER JOIN turkish ON translate.turkish_id = turkish.id WHERE translate.turkish_id IN (SELECT id FROM turkish WHERE word LIKE '$scbc')" 2>&1 | cat -n | zenity --text-info --title "search results..." --width 600 --height 300 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * A simple libpng example program | |
| * http://zarb.org/~gc/html/libpng.html | |
| * | |
| * Modified by Yoshimasa Niwa to make it much simpler | |
| * and support all defined color_type. | |
| * | |
| * To build, use the next instruction on OS X. | |
| * $ brew install libpng | |
| * $ clang -lz -lpng16 libpng_test.c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* ヘッダファイルのインクルード */ | |
| /* 既定のヘッダファイル */ | |
| #include <stdio.h> /* 標準入出力 */ | |
| #include <stdlib.h> /* 標準ユーティリティ */ | |
| #include <string.h> /* 文字列処理 */ | |
| #include <png.h> /* libpng */ | |
| /* 独自のヘッダファイル */ | |
| #include "bitmap.h" /* ビットマップ */ | |
| /* main関数の定義 */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| </proc/net/dev grep -oP "wlp6s0"':\s*(\d+\s+){8}\K\d+' | awk '{x=$1; split("B KB MB GB TB PB",type); for(i=5;y < 1;i--) y = x / (2**(10*i)); printf("%.2f %s\n",y,type[i+2])}' | |
| </proc/net/dev grep -oP "wlp6s0"':\s*(\d+\s+){8}\K\d+' | awk '{ byte =$1 /1024/1024; print byte " MB" }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| </proc/net/dev grep -oP "wlp6s0"':\s*\K\d+' | awk '{x=$1; split("B KB MB GB TB PB",type); for(i=5;y < 1;i--) y = x / (2**(10*i)); printf("%.2f %s\n",y,type[i+2])}' | |
| </proc/net/dev grep -oP "wlp6s0"':\s*\K\d+' | awk '{ byte =$1 /1024/1024; print byte " MB" }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Steps to configure this server to send mail via gmail relay | |
| 1. Download postfix and required packages | |
| sudo apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules | |
| 2. Configure gmail as relay host : in /etc/postfix/main.cf | |
| relayhost = [smtp.gmail.com]:587 | |
| smtpd_sasl_auth_enable = yes | |
| smtp_sasl_auth_enable = yes | |
| smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd | |
| smtp_sasl_security_options = noanonymous |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| read -p "enter a date to list installed pakages 2020-12-12 14:" date ; awk 'FNR==1{nf++} ; nf==1{for (i=1;i<=NF;i++) a[$i]=1} ; nf==2{for (i=1;i<NF;i++) if (a[$i]==0) printf "%s ",$i}' <(cat /var/log/dpkg.log | awk -v d="$date" '/ trigproc / && $0 ~ d {print $4}' | awk '{printf "%s ", gensub(/:.*/,"\\1", "g", $1); }') <(cat /var/log/dpkg.log | awk -v d="$date" '/ installed / && $0 ~ d {print $5}' | awk '{printf "%s ", gensub(/:.*/,"\\1", "g", $1); }') |