Skip to content

Instantly share code, notes, and snippets.

View sputnikus's full-sized avatar

Martin Putniorz sputnikus

  • Freelance
  • Brno, Czech Republic
View GitHub Profile
@sputnikus
sputnikus / to_be_a_beast.py
Created October 14, 2018 09:54
Macro calculation based on the To Be a Beast article https://www.barbellmedicine.com/584-2/ by Jordan Feigenbaum
#!/usr/bin/env python
import enum
from math import ceil
import click
MALE = "male"
FEMALE = "female"
CUT = "cut"
gw0 [receiver-thread] RECEIVERTHREAD: starting to run
gw0 sent <Message CHANNEL_EXEC channel=1 lendata=7086>
gw0 sent <Message CHANNEL_DATA channel=1 lendata=1935>
gw1 [receiver-thread] RECEIVERTHREAD: starting to run
gw1 sent <Message CHANNEL_EXEC channel=1 lendata=7086>
gw1 sent <Message CHANNEL_DATA channel=1 lendata=1935>
gw0 [receiver-thread] received <Message CHANNEL_DATA channel=1 lendata=390>
gw0 [receiver-thread] received <Message CHANNEL_DATA channel=1 lendata=27>
gw0 [receiver-thread] received <Message CHANNEL_DATA channel=1 lendata=124>
gw0 [receiver-thread] received <Message CHANNEL_DATA channel=1 lendata=135>
@sputnikus
sputnikus / build.sh
Created June 4, 2014 05:43
End-To-End extension build script fo Arch Linux
#!/usr/bin/env bash
jscompile_e2e="python2 closure-library/closure/bin/build/closurebuilder.py --root end-to-end --root closure-library --root closure-templates/javascript --root zlib.js/src --root typedarray -o compiled -c compiler.jar"
csscompile_e2e="java -jar closure-stylesheets-20111230.jar end-to-end/javascript/crypto/e2e/extension/ui/styles/base.css"
# compile javascript files
$jscompile_e2e -i end-to-end/javascript/crypto/e2e/extension/bootstrap.js > end-to-end/javascript/crypto/e2e/extension/launcher_binary.js
$jscompile_e2e -i end-to-end/javascript/crypto/e2e/extension/helper/helper.js > end-to-end/javascript/crypto/e2e/extension/helper_binary.js
$jscompile_e2e -i end-to-end/javascript/crypto/e2e/extension/ui/glass/bootstrap.js > end-to-end/javascript/crypto/e2e/extension/glass_binary.js
$jscompile_e2e -i end-to-end/javascript/crypto/e2e/extension/ui/prompt/prompt.js > end-to-end/javascript/crypto/e2e/extension/prompt_binary.js
@sputnikus
sputnikus / gist:4881ddd57e99d3bd4d22
Created June 3, 2014 14:17
64-bit Linux build of Light Table 0.6.6
$ ldd /opt/LightTable/ltbin
linux-gate.so.1 (0xf77d2000)
libX11.so.6 => /usr/lib32/libX11.so.6 (0xf7645000)
libXrender.so.1 => /usr/lib32/libXrender.so.1 (0xf763a000)
librt.so.1 => /usr/lib32/librt.so.1 (0xf7631000)
libdl.so.2 => /usr/lib32/libdl.so.2 (0xf762c000)
libgobject-2.0.so.0 => /usr/lib32/libgobject-2.0.so.0 (0xf75da000)
libglib-2.0.so.0 => /usr/lib32/libglib-2.0.so.0 (0xf74cf000)
libgtk-x11-2.0.so.0 => /usr/lib32/libgtk-x11-2.0.so.0 (0xf706c000)
libgdk-x11-2.0.so.0 => /usr/lib32/libgdk-x11-2.0.so.0 (0xf6fbd000)
@sputnikus
sputnikus / PKGBUILD
Last active August 29, 2015 13:59
Popcorn Time 0.2.9 PKGBUILD
# Maintainer: Attila Bukor <r1pp3rj4ck [at] w4it [dot] eu>
# Contributor: Eric Engestrom <aur [at] engestrom [dot] ch>
# Contributor: Iwan Timmer <irtimmer@gmail.com>
# Contributor: Ricardo Band <me [at] xengi [dot] de>
# Contributor: Martin Putniorz <mputniorz [at] gmail [dot] com>
pkgname=popcorntime
pkgver=0.2.9
pkgrel=1
pkgdesc="Stream movies from torrents. Skip the downloads. Launch, click, watch."

Keybase proof

I hereby claim:

  • I am sputnikus on github.
  • I am sputnikus (https://keybase.io/sputnikus) on keybase.
  • I have a public key whose fingerprint is FF9A 3F36 90C9 C8D6 D52F 1D2D 25CA 9B71 1609 D2CB

To claim this, I am signing this object:

import xchat, re, requests
from requests.auth import HTTPBasicAuth
__module_name__ = "vlcnowplaying"
__module_version__ = "1.1"
__module_description__ = "sputnikus' Now playing script for vlc"
metare = re.compile("""<meta\-information\>
\<title\>\<\!\[CDATA\[(.*)\]\]\>\<\/title\>
\<artist\>\<\!\[CDATA\[(.*)\]\]\>\<\/artist\>
\<genre\>\<\!\[CDATA\[(.*)\]\]\>\<\/genre\>
@sputnikus
sputnikus / hstore_en.md
Last active December 29, 2015 15:29
PyVo 28.11.2013 Lightning Eng version

hstore

Postgres

create extension hstore;

Key/value inside db column, keys and values are string-only

k => v

foo => bar, baz => whatever

@sputnikus
sputnikus / dupla_dicts.py
Created December 6, 2012 19:57
Eliminate duplicate dicts from list
# dupla_list = list full of duplicates
seen = set()
clean_list = []
for item in dupla_list:
props = tuple(item.items())
if props not in seen:
seen.add(props)
clean_list.append(item)
@sputnikus
sputnikus / sort_dates.py
Created November 27, 2012 12:49
How to sort list of dates in format '13 July 2011'
>>> import time
>>> format = '%d %B %Y'
>>> sort_dates = lambda y: sorted(y, key=lambda x: int(time.mktime(time.strptime(x, format))))
>>> dates = ['13 July 2011', '13 August 2011', '3 October 2010', '13 July 2012']
>>> sort_dates(dates)
['3 October 2010', '13 July 2011', '13 August 2011', '13 July 2012']