Skip to content

Instantly share code, notes, and snippets.

View DmitryMyadzelets's full-sized avatar

Dmitry Myadzelets DmitryMyadzelets

View GitHub Profile
#!/usr/bin/python -O
from collections import defaultdict
from random import random, choice
from string import ascii_lowercase
from subprocess import Popen, PIPE
from time import time, sleep
# get a list of words with only ASCII characters
words = [w.strip().lower() for w in open("/usr/share/dict/words").readlines()]
words = [w for w in words if all([c in ascii_lowercase for c in w])]
@DmitryMyadzelets
DmitryMyadzelets / gist:21d071d88f2ec95d3487
Created September 5, 2014 14:12
Transliteration of cyrilic of Russian alphabet, GOST R 52535.1-2006 (Appendix A)
Транслитерация кириллицы для русского алфавита, ГОСТ Р 52535.1-2006 (Приложение А)
Transliteration of cyrilic of Russian alphabet, GOST R 52535.1-2006 (Appendix A)
1 А A
2 Б B
3 В V
4 Г G
5 Д D
6 Е E
7 Ё E
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Olivier Scherrer
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Installing Sublime Text 2
# Based on [https://gist.github.com/jansanchez/6202643]
# Download the latest version from: http://www.sublimetext.com/2
cd ~/downloads
# wget http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.2.tar.bz2
# Unpack it
tar -xvf Sublime\ Text\ 2.0.2.tar.bz2
# Move the folder to "/opt"
sudo mv Sublime\ Text\ 2 /opt/
# Create a symbolic link in "/usr/bin":
@DmitryMyadzelets
DmitryMyadzelets / xscreensaver.sh
Last active June 5, 2016 23:07
How to replace ugly lock screen in CrunchBang Waldorf
# I followed an instruction at [http://crunchbang.org/forums/viewtopic.php?id=23158]
# Remove old one
sudo apt-get remove xscreensaver
# You may need install dependencies to build xscreensaver
apt-get install libgd2-xpm libgd2-xpm-dev libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-dev libglade2-0 libglade2-dev libjpeg8-dev libxpm4 libxpm-dev libxt-dev
# During installation I got a message that the intltool is missing
apt-get install intltool
@DmitryMyadzelets
DmitryMyadzelets / afterMethod.js
Last active August 29, 2015 14:15
Simple observer of object's methods
/**
* Sets a hook for a method call for the given object. Acts as a simple observer of object's methods.
* @param {Object} object An object.
* @param {Function} method A method of the object.
* @param {Function} hook A callback function which will be called after the call of object's method.
* @param {Function} [context] Context which will passed to the hook instead of `this`.
* @return {Function} after Returns itself for chained calls.
*/
function after(object, method, hook, that) {
var old = object[method];
@DmitryMyadzelets
DmitryMyadzelets / inxi-F
Last active April 7, 2020 10:49
inxi -F
System: Host: hp6710b Kernel: 3.2.0-4-486 i686 (32 bit) Desktop: Openbox 3.5.0
Distro: CrunchBang Linux waldorf
Machine: System: Hewlett-Packard product: HP Compaq 6710b (GR680EA#ACB) v: F.18
Mobo: Hewlett-Packard model: 30C0 v: KBC Version 71.2E
Bios: Hewlett-Packard v: 68DDU Ver. F.18 date: 07/12/2011
CPU: Single core Intel Core2 Duo T7250 (-UP-) cache: 2048 KB speed: 2000 MHz (max)
Graphics: Card: Intel Mobile GM965/GL960 Integrated Graphics Controller (primary)
Display Server: X.Org 1.12.4 drivers: intel (unloaded: fbdev,vesa) Resolution: 1280x800@60.0hz
GLX Renderer: Mesa DRI Intel 965GM x86/MMX/SSE2 GLX Version: 2.1 Mesa 8.0.5
Audio: Card Intel 82801H (ICH8 Family) HD Audio Controller driver: snd_hda_intel Sound: ALSA v: 1.0.24
@DmitryMyadzelets
DmitryMyadzelets / compress_js.sh
Created April 23, 2015 14:37
Compresses JS file using Google Closure Compiler's Web API
# usage: ./compress_js.sh file.js compressed/file.js
curl -d compilation_level=SIMPLE_OPTIMIZATIONS -d output_format=text -d output_info=compiled_code --data-urlencode "js_code@$1" http://closure-compiler.appspot.com/compile > $2
@DmitryMyadzelets
DmitryMyadzelets / eysenck_personality.json
Last active August 29, 2015 14:20
Eysenck's personality test in Cyrillic. Questions and Keys
{
"questions":[
{
"id":1,
"question":"Часто ли вы испытываете тягу к новым впечатлениям, к тому, чтобы «встряхнуться», испытать возбуждение?",
"value":true
},
{
"id":2,
"question":"Часто ли вы нуждаетесь в друзьях, которые вас понимают, могут ободрить или утешить?",
@DmitryMyadzelets
DmitryMyadzelets / fix_crunchbang.md
Last active October 29, 2015 10:24
My steps to make Crunchbang Waldorf working

ping works, but the browser, wget, synaptic etc don't

For example, ping google.com works via WiFi but wget google.com doesn't. Run sudo vi /etc/dhcp/dhclient.conf, and there add a string with DNS servers: prepend domain-name-servers 8.8.8.8, 8.8.4.4;

Firefox vs Iceweasel

sudo apt-get remove iceweasel
sudo echo -e "\ndeb http://downloads.sourceforge.net/project/ubuntuzilla/mozilla/apt all main" | sudo tee -a /etc/apt/sources.list > /dev/null

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com C1289A29