Skip to content

Instantly share code, notes, and snippets.

View corvax19's full-sized avatar

romans.krjukovs corvax19

  • Riga, Latvia
  • 05:33 (UTC +03:00)
View GitHub Profile
@corvax19
corvax19 / topio.py
Created January 17, 2013 16:13
Script measures IO activity of the processes for a specified amount of time and return top list of those. Read, write or both IO operation could be measured and reported.
#!/usr/bin/python
import subprocess
import sys
import time
from optparse import OptionParser
def getOptionParser():
parser = OptionParser(version = '0.1_2012017',
description = '''Script measures IO activity of the processes for a specified amount of time
@corvax19
corvax19 / gist_weather.py
Last active December 9, 2015 23:39
gist_weather
from urllib import urlopen;
import json, sys;
url = "http://openweathermap.org/data/2.1/find/name?q=" + city;
t = json.load(urlopen(url))['list'][0]['main']['temp'] - 273.15;
print t;
@corvax19
corvax19 / tmux
Last active November 21, 2021 15:58
/cheat-sheets
tmux -- terminal multiplexer
Managing tmux sessions:
$ tmux # start tmux server
$ tmux at # attach running sessions to a terminal
$ tmux ls # list running tmux sessions
$ exit # close tmux session
Sharing sessions between terminals:
$ tmux new -s session_name # make new named session
@corvax19
corvax19 / openssh-encrypt-decrypt.txt
Last active July 28, 2023 14:10
[/linux/openSSL] Simple text #encryption/#decryption with #openssl
echo -n "That's the text"|openssl enc -e -aes-256-cbc -a
Encrypt with interactive password. Encrypted message is base64-encoded afterwards.
echo -n "That's the text"|openssl enc -e -aes-256-cbc -a -k "MySuperPassword"
Encrypt with specified password. Encrypted message is base64-encoded afterwards.
echo "GVkYiq1b4M/8ZansBC3Jwx/UtGZzlxJPpygyC"|openssl base64 -d|openssl enc -d -aes-256-cbc
Base-64 decode and decrypt message with interactive password.
echo "GVkYiq1b4M/8ZansBC3Jwx/UtGZzlxJPpygyC"|openssl base64 -d|openssl enc -d -aes-256-cbc -k "MySuperPassword"
@corvax19
corvax19 / gist:4135359
Created November 23, 2012 12:15
Simple DNS resolve monitor with email notification #singleliner
ping -q -i1 -c3 target 2>&1|awk '/unknown host/{system("mailx -s \""$4" DNS resolution failed on `uname -n` at `date`\" bill.gates@microsoft.com >/dev/null")} /[:alpha:]/{S=S" "$0} END {print S}'
@corvax19
corvax19 / gist:4123377
Created November 21, 2012 06:27
vnstat - Network Traffic Monitor / http://goo.gl/68H3t
Configuration
Edit /etc/sysconfig/vnstat, enter:
# vi /etc/sysconfig/vnstat
Sample outputs:
VNSTAT_OPTIONS="-u -i eth0"
Edit /etc/vnstat.conf, enter:
# vi /etc/vnstat.conf