Skip to content

Instantly share code, notes, and snippets.

View kvbik's full-sized avatar

Jakub Vysoký kvbik

View GitHub Profile
#!/bin/bash
# git clone https://gist.github.com/kvbik/2f90a73d3acd9fb1ef4d2a45c5f9cfe8
# current macos wifi connection, thx to
# https://apple.stackexchange.com/questions/81221/how-do-i-get-wi-fi-info-from-within-terminal
W=$(
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | \
sed -n '/^[ ]*SSID: / s/^[ ]*SSID: //p'
)

Keybase proof

I hereby claim:

  • I am kvbik on github.
  • I am kvbik (https://keybase.io/kvbik) on keybase.
  • I have a public key ASAkBk-4on0EHqAwp69X3Cxw0hHo_44sk6JctMNHkruRbwo

To claim this, I am signing this object:

@kvbik
kvbik / min-pro-tatu.py
Last active May 3, 2017 10:36
min() a max() tatuv ukol
class WeNeedArgumentsException(Exception):
pass
def min(*args, key=lambda x: x):
sequence = args
if len(args) == 1:
sequence = args[0]
if len(sequence) == 0:
raise WeNeedArgumentsException('we need arguments')
@kvbik
kvbik / 00-nastaveni.txt
Last active December 10, 2016 16:11
pyworking 2016/12/10 django
Nastavit http://bit.ly/pyworking-prg-01
=======================================
* Pythonanywhere.com - ucet
* Github.com - ucet
* Vytvorit na https://github.com repository "prvniblog"
- Initialize with README
- Add .gitignore Python
- Create repository
@kvbik
kvbik / hubot-bootstrap.sh
Created January 9, 2014 12:20
bootstrap custom hubot without installing hubot libraries globally
TMP_HUBOT=/tmp/blah
MY_HUBOT=/tmp/realhubot
# temporary hubot
mkdir $TMP_HUBOT
cd $TMP_HUBOT
npm install hubot coffee-script
# init custom hubot
./node_modules/.bin/coffee ./node_modules/.bin/hubot --create $MY_HUBOT
@kvbik
kvbik / date_dump.py
Created September 27, 2013 14:15
useful for json
def dump_utc_datetime(x):
return (
x.year, x.month, x.day,
x.hour, x.minute, x.second,
x.microsecond
)
def load_utc_datetime(x):
d = datetime.datetime(*x)
return d.replace(tzinfo=pytz.utc)
@kvbik
kvbik / semafor.js
Created February 26, 2013 00:10
and finally semafor i did for @aleszoulek
var bb = require('./bonescript');
var ledPin0 = bone.USR3;
var ledPin1 = bone.P8_3;
var ledPin2 = bone.P8_5;
var ledPin3 = bone.P8_7;
setup = function() {
pinMode(ledPin0, OUTPUT);
pinMode(ledPin1, OUTPUT);
@kvbik
kvbik / koko.sh
Created February 26, 2013 00:08
and some weird stuff i did on the same #beaglebone in shell
for i in `seq 0 3`; do
echo 0 > /sys/devices/platform/leds-gpio/leds/beaglebone::usr$i/brightness
done
echo 1 > /sys/devices/platform/leds-gpio/leds/beaglebone::usr0/brightness
sleep 0.2s
echo 0 > /sys/devices/platform/leds-gpio/leds/beaglebone::usr0/brightness
echo 1 > /sys/devices/platform/leds-gpio/leds/beaglebone::usr2/brightness
sleep 0.3s
echo 0 > /sys/devices/platform/leds-gpio/leds/beaglebone::usr2/brightness
@kvbik
kvbik / koko.py
Created February 25, 2013 22:16
#beaglebone #knightrider made by @starenka
#!/usr/bin/env python
import time
LED = '/sys/devices/platform/leds-gpio/leds/beaglebone::usr%d/%s'
def _write(dev, mode='brightness', val=1, sleep=0):
s = open(LED % (dev, mode), 'w')
s.write(str(val))
s.close()
time.sleep(sleep)
@kvbik
kvbik / Dockerfile
Created October 28, 2015 17:50
simple container based on ubuntu including python and gis (geo stuff)
FROM ubuntu:trusty
RUN apt-get update
RUN apt-get install -qyy \
-o APT::Install-Recommends=false -o APT::Install-Suggests=false \
binutils libproj-dev gdal-bin \
libpq-dev python-dev libxml2-dev libxslt1-dev libffi-dev xmlsec1 \
python2.7 unzip virtualenvwrapper
WORKDIR /app