Skip to content

Instantly share code, notes, and snippets.

View gko's full-sized avatar
🐑
📃💨

Konstantin gko

🐑
📃💨
View GitHub Profile
PS1="\n$background_blue \W/$(rvm_version_prompt) $background_green$(__gi t_ps1 " (%s) ")\n$normal$(echo -e " ℜ") ${normal}"
@gko
gko / sopcast.bash
Created July 14, 2012 16:56
sopcast command line tool
#!/usr/bin/bash
if [ "$(pgrep sp-sc-auth)" ]; then
killall sp-sc-auth;
fi
sp-sc-auth $1 3908 8908 > /dev/null &
sleep 10 && vlc http://localhost:8908/tv.asf
set langmap=ёйцукенгшщзхъфывапролджэячсмитьбюЁЙЦУКЕHГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ;`qwertyuiop[]asdfghjkl\\;'zxcvbnm\\,.~QWERTYUIOP{}ASDFGHJKL:\\"ZXCVBNM<>
/*.Button {*/
.Button {
...
}
.Button:hover {
...
}
/*}*/
@gko
gko / gist:1e06b20e92bacad303f6
Last active August 29, 2015 14:01
"a.b.c.d" -> {a: {b: {c: "d"}}}
function p(s) {
var a = s.split('.').reverse(),
_p = function(a, d, o) {
var i=o?0:1;
if(d>0) {
var t={}; t[a[i]]=o||a[0];
return _p(a.slice(1+i), d-1-i, t);
} else return o;
};
return _p(a, a.length);
@gko
gko / string.js
Last active August 29, 2015 14:10
string functions for js
/**
* number of occurences of substring
*/
String.prototype.occurences = function(str, from, to) {
return this.substr(from||0, (to||this.length)-(from||0)).split(str).length-1;
};
/**
* whether string starts with another string
*/
@gko
gko / stream.sh
Created January 8, 2017 14:11
stream your system audio to network
#!/bin/bash
# you can find listbox `https://github.com/gko/listbox`
source ~/listbox/listbox.sh
listbox -t "Stream:" -o "$(pactl list | grep "Monitor Source" | sed -e "s/.*Monitor Source:\s//" | tr '\n' '|')" -r stream
echo ""
cvlc -vvv pulse://"$stream" --sout '#transcode{acodec=mp3,ab=128,channels=2}:standard{access=http,dst=0.0.0.0:8888/t.mp3}'
@gko
gko / project.sh
Last active January 21, 2017 14:18
create npm project both locally and on github
#!/usr/bash
# Create npm package and repo for it on github
# usage: project test
# for private repo: project -p test
project() {
while [[ $# -gt 0 ]]
do
key="$1"
@gko
gko / Menu.html
Last active May 2, 2017 06:39
burger menu
<div class="Menu">
<div class="Menu-line"></div>
<div class="Menu-line"></div>
</div>
@gko
gko / addCert.sh
Created August 9, 2017 17:00
cower certificate
curl "https://pgp.mit.edu/pks/lookup?op=get&search=0x1EB2638FF56C0C53" -o - | gpg --import