Skip to content

Instantly share code, notes, and snippets.

@gjask
gjask / devconfwifi.sh
Created January 27, 2019 11:07
DevConfCZ WiFi login script
#!/bin/bash
USER='devconfcz'
PASSWORD='Brno2019'
curl https://147.229.254.98/login.php \
-H 'Host: wifigw.cis.vutbr.cz' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data "user=${USER}&auth=any&password=${PASSWORD}" \
--compressed -k -o /dev/null
@gjask
gjask / userChrome.css
Created January 3, 2018 10:04
tweak Tab Center Redux
@namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
#tabbrowser-tabs {
visibility: collapse;
}
#sidebar-box[sidebarcommand="_0ad88674-2b41-4cfb-99e3-e206c74a0076_-sidebar-action"] #sidebar-header {
visibility: collapse;
}
#!/bin/bash
name='John Doe'
email='john.doe@email.com'
path=$( dirname $0 )
while [ -n "$1" ]; do
case "$1" in
@gjask
gjask / pure_sql_pivot.sql
Created November 8, 2016 21:30
pure SQL PIVOT alternative
select
number_id,
sum(case when gate = 1 then points end) gate1,
sum(case when gate = 2 then points end) gate2,
sum(points) points_total
from check
group by number_id;
@gjask
gjask / SETTLE_UP.js
Last active August 3, 2018 12:57
Google spreadsheet custom function settling up debts in group of people.
function SETTLE_UP(data) {
var min = 0;
var max = 0;
var debter = 0;
var crediter = 0;
var amount = 0;
var names = data[0];
var values = data[1];
import simplejson as json
import lxml
class objectJSONEncoder(json.JSONEncoder):
"""A specialized JSON encoder that can handle simple lxml objectify types
>>> from lxml import objectify
>>> obj = objectify.fromstring("<Book><price>1.50</price><author>W. Shakespeare</author></Book>")
>>> json.dumps(obj, cls=objectJSONEncoder)
'{"price": 1.5, "author": "W. Shakespeare"}'
"""
(lambda _, __, ___, ____, _____, ______, _______, ________:
getattr(
__import__(True.__class__.__name__[_] + [].__class__.__name__[__]),
().__class__.__eq__.__class__.__name__[:__] +
().__iter__().__class__.__name__[_____:________]
)(
_, (lambda _, __, ___: _(_, __, ___))(
lambda _, __, ___:
chr(___ % __) + _(_, __, ___ // __) if ___ else
(lambda: _).func_code.co_lnotab,
<VirtualHost *:80>
ServerAdmin admin@skrle.cz
DocumentRoot /var/www/flask/lillyleague
ServerName atea.skrle.cz
WSGIDaemonProcess lillyleague user=jask group=jask threads=1 home=/var/www/flask/lillyleague
WSGIScriptAlias / /var/www/flask/lillyleague/wsgi.py
WSGIPassAuthorization On
<Directory /var/www/flask/lillyleague>
@gjask
gjask / remote-script.sh
Created February 25, 2016 10:28
Naive tool for distributed execution of commands and shell scripts on remote machines
#!/bin/bash
# author: jask
# WARNING: this script is intended to use only for those who have deep understanding how it works, so enjoy the fun with it ;)
interpret='bash'
#ssh_args='-i .ssh/atollon'
#user='jask'
usage(){
@gjask
gjask / flip_go_board.py
Last active February 25, 2016 09:21
Reads go sgf file from stdin and returns 180 degrees rotated on stdout
import re
import string
import sys
class Flipper(object):
flip_re = re.compile('\[([a-z]{2})\]')
def __init__(self, board_size=19):
self.board_size = board_size