Skip to content

Instantly share code, notes, and snippets.

View defHLT's full-sized avatar
🐔

Artem Kholodnyi defHLT

🐔
View GitHub Profile
require 'benchmark'
require 'set'
arr = []
set = Set.new
1000.times do |_|
r = rand(1000)
arr << r
set << r
# See "Lisp Macros in 20 Minutes"
# at http://www.slideshare.net/pcalcado/lisp-macros-in-20-minutes-featuring-clojure-presentation
# Ruby implementation var. 1 {
def from(names)
keys, vals = [], []
i = -1
names.each do |name|
r = yield name
# Get the compile-dependencies of vim
sudo apt-get build-dep vim
# If you haven't got mercurial, checkinstall
sudo apt-get install mercurial checkinstall
# Get the source
hg clone https://vim.googlecode.com/hg/ vim
# Compile it
cd vim
./configure \
--enable-luainterp=dynamic \
#!/usr/bin/ruby
# encoding: utf-8
# Created: 2013-03-30 11:49:19 +0200
# How often to check in seconds:
TIMEOUT = 10
# Alert when lag is greates then in seconds:
LAG_MAX = 0.05
STDOUT.sync = true
#!/usr/bin/ruby
output = `xrandr`
lvds = output[/LVDS connected.*mm/]
dfp1 = output[/DFP1 connected.*mm/]
if lvds && dfp1
status = "(both)"
options = "lvds\ndfp1"
elsif lvds
status = "(lvds)"
Aug 4 16:59:51 distantstar kernel: [61280.385755] Xorg: page allocation failure: order:5, mode:0x1040d0
Aug 4 16:59:51 distantstar kernel: [61280.385767] Pid: 1590, comm: Xorg Tainted: PF O 3.9.0-030900-generic #201304291257
Aug 4 16:59:51 distantstar kernel: [61280.385769] Call Trace:
Aug 4 16:59:51 distantstar kernel: [61280.385778] [<ffffffff8113bd56>] warn_alloc_failed+0xf6/0x150
Aug 4 16:59:51 distantstar kernel: [61280.385783] [<ffffffff816eec17>] ? __alloc_pages_direct_compact+0x1ad/0x1bf
Aug 4 16:59:51 distantstar kernel: [61280.385786] [<ffffffff8113faa0>] __alloc_pages_nodemask+0x860/0x990
Aug 4 16:59:51 distantstar kernel: [61280.385790] [<ffffffff8117c66a>] alloc_pages_current+0xba/0x170
Aug 4 16:59:51 distantstar kernel: [61280.385793] [<ffffffff8113ab5e>] __get_free_pages+0xe/0x40
Aug 4 16:59:51 distantstar kernel: [61280.385796] [<ffffffff8118653f>] kmalloc_order_trace+0x3f/0xd0
Aug 4 16:59:51 distantstar kernel: [61280.385901] [<ffffffffa01af8e2>] ? firegl_trace+0x72/
#!/usr/bin/ruby
# encoding: utf-8
# Created: 2013-04-19 17:51:52 +0300 by ice
# Generates beautiful bitcoin address
STDOUT.sync = true
%w{
openssl
benchmark
@defHLT
defHLT / gen_icons.sh
Last active December 23, 2015 01:38
#!/usr/bin/zsh
# e.g. -> ./gen_icons.sh ic_launcher.svg
#
PNGS=""
BASENAME=`basename $1 .svg`
mkdir -p drawable-{mdpi,hdpi,xhdpi,xxhdpi} google-play
inkscape -z -h 48 -w 48 -e drawable-mdpi/$BASENAME.png $1
inkscape -z -h 72 -w 72 -e drawable-hdpi/$BASENAME.png $1
inkscape -z -h 96 -w 96 -e drawable-xhdpi/$BASENAME.png $1
inkscape -z -h 144 -w 144 -e drawable-xxhdpi/$BASENAME.png $1
@defHLT
defHLT / moai
Last active December 24, 2015 09:28
--------- beginning of /dev/log/system
I/WindowManager( 2878): Setting rotation to 1, animFlags=1
I/ActivityManager( 2878): Config changed: { scale=1.0 imsi=0/0 loc=en_GB touch=3 keys=1/1/2 nav=1/1 orien=2 layout=34 uiMode=17 seq=18 themeResource=null}
--------- beginning of /dev/log/main
E/ApplicationContext( 7416): Couldn't rename file /data/data/com.endomondo.android.pro/shared_prefs/com.endomondo.android.pro_preferences.xml to backup file /data/data/com.endomondo.android.pro/shared_prefs/com.endomondo.android.pro_preferences.xml.bak
E/ApplicationContext( 7416): Couldn't rename file /data/data/com.endomondo.android.pro/shared_prefs/com.endomondo.android.pro_preferences.xml to backup file /data/data/com.endomondo.android.pro/shared_prefs/com.endomondo.android.pro_preferences.xml.bak
E/ApplicationContext( 7416): Couldn't rename file /data/data/com.endomondo.android.pro/shared_prefs/com.endomondo.android.pro_preferences.xml to backup file /data/data/com.endomondo.android.pro/shared_prefs/com.endomondo.android
varying LOWP vec2 texcoord;
uniform sampler2D bgl_RenderedTexture;
float samples[11];
void main()
{
/*vec2 texcoord = gl_TexCoord[0].xy*/