Skip to content

Instantly share code, notes, and snippets.

View libbkmz's full-sized avatar

Ilya libbkmz

View GitHub Profile
@libbkmz
libbkmz / cleaner.awk
Last active August 29, 2015 13:56
Remove PHP session files from mod-tmp. ISPManager
BEGIN{
system("ionice -c3 -p " PROCINFO["pid"]);
system("renice -n 19 -p " PROCINFO["pid"]);
dir_len = 0
while ("ls -1 /var/www" | getline) {
dirs[dir_len++] = $0
}
for(i=0;i<dir_len;i++){
if test -d .hg
set -g __hg_branch (hg branch 2> /dev/null)
set -g __hg_dirty (hg status 2> /dev/null | grep -v "?" | sort | uniq | head -c1)
printf "%s@%s %s%s%s (%s%s%s%s%s)%s%s%s%s " $USER $__fish_prompt_hostname "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" (set_color -b 5fff5f) (set_color red) $__hg_branch (set_color normal) (set_color -b normal) (set_color red) $__hg_dirty (set_color normal) $user_prompt
else
printf '%s@%s %s%s%s%s%s ' $USER $__fish_prompt_hostname "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" $user_prompt
end
@libbkmz
libbkmz / gist:505bacd7f228fafbfe32
Last active August 29, 2015 14:01
requests per minute. Sort by time and ip
cat /var/log/nginx/access.log.1 | cut -d " " -f1,4,7 | sed -r 's/^(.+)?:([0-9]{2}):([0-9]{2}):([0-9]{2})(.+)$/\1:\2:\3 \5/g' | awk '{print $2 " " $1 " " $3 }' | sort | uniq -c | sort -g | tail -n 1000
mesg
<6>[ 0.000000] Booting Linux on physical CPU 0
<6>[ 0.000000] Initializing cgroup subsys cpu
<5>[ 0.000000] Linux version 3.4.0-gcb7e7de (tassadar@nymeria) (gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #4 SMP PREEMPT Wed Sep 4 18:22:32 CEST 2013
<4>[ 0.000000] CPU: ARMv7 Processor [511f06f0] revision 0 (ARMv7), cr=10c5387d
<4>[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
<4>[ 0.000000] Machine: QCT APQ8064 FLO
<2>[ 0.000000] Truncating memory at 0x90000000 to fit in 32-bit physical address space
<6>[ 0.000000] cma: CMA: reserved 80 MiB at a0000000
<6>[ 0.000000] memory pool 3 (start 0xfe900000 size 1600000) initialized
@libbkmz
libbkmz / 1
Last active August 29, 2015 14:07
kohctpyktop
eNrtWltygzAMrLX89Ay9Qv97lt7/Ii0Qg2SvjIE0DRORyWsWWZa8kh9i+Bw+3r/T
+1ca3o68QvCxgkn9SkPqE0xG8G1IfRqFvnbbmPbZuNqVggAhGIL90c8FO6KfCXZF
/7aNaZ+Nm9FvBdNRr/6B4I6EfFmuvoKNlxeclnPiXxMKgL7Po4JRyfgX06/5vxh0
+pxEOHprAo4s8uW0vLZRoOoDFAXv8627WadFFzhrtugsOI6Mg4tKq+4t+mqj8nh0
6TeDK+PsLZa8qxeN//QtgvG2tb3lNlEDMN5QjhHUEGY1GS14c4MX1PLmV78lhyXO
2D3DLMuc0QKXtDJbmPGS6JikV1igaXHzyto5LCE4N7JyN6Nz6K600qiUrEaJLl+q
jyWqo9i2XDh7MdkGquBRecule1dCDTTQQAN9bTRSpY/m+RfhjUANWjMjfBWp8vIo
7LasSIb226DlFoDqdYMFejsXxHvOqbDMdzoZNsaXMKPWC09vxQy7Cz9mEaxq/Iuf
/0tvpMo7psrmulGa68Z2uotkePFU2Vw3tscXTb04l+7umkgDjVTZPd8d2ESjPE3f
pRcI4l0BxYHJjjBjF6+eke1X1vtEqfIOlfB1WnQr4U3UNOGUDXdXwskSgNbJxamT
program HelloWorld(output);
var
i: integer;
N: integer;
K: integer;
begin
N:= 103;
K:= 20;
i:=N;
scrot '%d-%m-%Y-%H:%M:%S_$wx$h.png' -e 'mv $f ~/Yandex.Disk/screens/ ; yandex-disk publish ~/Yandex.Disk/screens/$f | xargs chromium '
@libbkmz
libbkmz / 1.py
Created October 24, 2014 07:00
show real tabled data
print "%s:%s%s" % (fp, " "*(30-len(fp)), value)
options {
directory "/var/named";
pid-file "/run/named/named.pid";
// Uncomment these to enable IPv6 connections support
// IPv4 will still work:
// listen-on-v6 { any; };
// Add this for no IPv4:
// listen-on { none; };
45: 0 0 0 1 PCI-MSI-edge eth0
46: 138902469 21349 251748 4223124 PCI-MSI-edge eth0-rx-0
47: 137306753 19896 260291 4741413 PCI-MSI-edge eth0-rx-1
48: 2916 137767992 248035 4559088 PCI-MSI-edge eth0-rx-2
49: 2860 138565213 244363 4627970 PCI-MSI-edge eth0-rx-3
50: 2584 14822 118410604 3576451 PCI-MSI-edge eth0-tx-0
51: 2175 15115 118588846 3440065 PCI-MSI-edge eth0-tx-1
52: 2197 14343 166912 121908883 PCI-MSI-edge eth0-tx-2
53: 1976 13245 157108 120248855 PCI-MSI-edge eth0-tx-3
54: 0 0 0 1 PCI-MSI-edge eth1