Skip to content

Instantly share code, notes, and snippets.

View Snawoot's full-sized avatar

Snawoot

View GitHub Profile
hdparm --user-master u --security-set-pass PasSWorD /dev/sdX
hdparm --user-master u --security-erase PasSWorD /dev/sdX
if isinstance(s, str):
if all([ord(c) in range(0,128) for c in s]):
#handle as ascii
else:
#handle CP1251 (.decode("cp1251").encode("utf-8") or drop nationa chars)
elif isinstance(s, unicode):
#handle as unicode
213.87.121.79 - - [19/May/2014:07:30:58 +0400] "GET /play/shanson/umnichka/?utm_source=adwords&utm_medium=cpc&utm_content=%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9%20%D1%88%D0%B0%D0%BD%D1%81%D0%BE%D0%BD&utm_campaign=GA_shanson&ref=1113&gclid=COqFiqKGt74CFcv7cgodyqsAbw HTTP/1.1" 502 742 "http://www.google.com/uds/afs?q=%D1%81%D0%BB%D1%83%D1%88%D0%B0%D1%82%D1%8C%20%D0%BC%D1%83%D0%B7%D1%8B%D0%BA%D1%83%20%D0%B1%D0%B5%D1%81%D0%BF%D0%BB%D0%B0%D1%82%D0%BD%D0%BE%20%D1%88%D0%B0%D0%BD%D1%81%D0%BE%D0%BD&client=aj-ru2&channel=ru16&hl=ru&adtest=off&adsafe=medium&oe=utf-8&ie=utf-8&lo=false&adpage=1&adrep=3&po=true&r=m&fexp=21404&format=p7%7Cn3&ad=n3p7&nocache=9221400481145859&num=0&output=uds_ads_only&v=3&adlh=on&adext=as1%2Csr1&u_his=2&u_tz=240&dt=1400481145861&u_w=1280&u_h=800&biw=-1&bih=-1&psw=-1&psh=-1&frm=0&ui=uv3sr1lo0po1va1hcsl1cc0-lHst15sd13sv13sa13lt18ld16lv16da1-lhst15sd13sv13sa13lt18ld16lv16da1&rurl=http%3A%2F%2Fru.ask.com%2Fweb%3Fq%3D%25D1%2581%25D0%25BB%25D1%2583%25D1%2588%25D0%25B0%25D1%2582%25D1%258C%2B%25D
yarmak@linux-commander:~$ avconv -i 33fb5e0b-17aa-4ee0-bc37-4fc0ed6f3c1b.mp4
avconv version 0.8.10-6:0.8.10-1, Copyright (c) 2000-2013 the Libav developers
built on Feb 5 2014 03:52:19 with gcc 4.7.2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '33fb5e0b-17aa-4ee0-bc37-4fc0ed6f3c1b.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1mp42
creation_time : 2014-04-24 10:12:09
Duration: 01:35:06.06, start: 0.000000, bitrate: 1885 kb/s
from itertools import groupby, chain
LOSE = [['G', 'A', 'M', 'E'], ['O', 'V', 'E', 'R'], ['G', 'A', 'M', 'E'], ['O', 'V', 'E', 'R']]
WIN = [['U', 'W', 'I', 'N'], ['U', 'W', 'I', 'N'], ['U', 'W', 'I', 'N'], ['U', 'W', 'I', 'N']]
def collide_row(row):
tiles = []
for k,g in groupby(filter(bool,row)):
l = len(list(g))
if l % 2:
yarmak@linux-commander:~$ cowsay -f hellokitty "Hello, kitty!"
_______________
< Hello, kitty! >
---------------
\
\
/\_)o<
| \
| O . O|
\_____/
yarmak@linux-commander:~$ cowsay -f sodomized-sheep "Schwooolah!!!"
_______________
< Schwooolah!!! >
---------------
\ __
\ (oo)
\ ( )
\ /--\
__ / \ \
UooU\.'@@@@@@`.\ )
int handleError(bool success, int errorCode) {
QHash<int, const char *> cm;
cm[400] = "Bad Request";
cm[401] = "Unauthorized";
cm[402] = "Payment Required";
cm[403] = "Forbidden";
cm[404] = "Page not found";
cm[405] = "Method Not Allowed";
cm[500] = "Internal Server Error";
cm[501] = "Not Implemented";
root@cache5:~# vc_file | figlet
_ _ ___ ___ _____ _____ _ _ __
| | | |___ __ _ __ _ ___ _ / _ \ / _ \___ |___ / (_)/ /
| | | / __|/ _` |/ _` |/ _ (_) | (_) | (_) | / / / /| | / /
| |_| \__ \ (_| | (_| | __/_ \__, |\__, |/ / / / | |/ /_
\___/|___/\__,_|\__, |\___(_) /_(_) /_//_/ /_/ |_/_/(_)
|___/
____ _ _ _ ____ ___ ____
/ ___|| |_ ___ _ __ ___ __| |_ / | ___| ( _ ) / ___|
\___ \| __/ _ \| '__/ _ \/ _` (_) | |___ \ / _ \| | _
root@ci:~# cat > hello.js
// A simple function.
function hello(longName) {
alert('Hello, ' + longName);
}
hello('New User');
root@ci:~# java -jar /usr/share/java/closure-compiler.jar --js hello.js --js_output_file hello-compiled.js
root@ci:~# cat hello-compiled.js
function hello(a){alert("Hello, "+a)}hello("New User");