Skip to content

Instantly share code, notes, and snippets.

View tgrk's full-sized avatar

Martin Wišo tgrk

View GitHub Profile
@tgrk
tgrk / cdwifi.sh
Created October 5, 2022 14:42 — forked from bzamecnik/cdwifi.sh
Accept ČD Wifi on the command line (if you hate clicking). http://cdwifi.cz
#!/bin/bash
# Accept CD Wifi (Czech railways) on the command line (if you hate clicking).
# http://cdwifi.cz
#
# Put the script to ~/bin/cdwifi and make sure that export it's on the path: PATH=$PATH:~/bin
# Note that if you have a custom DNS set (eg. 8.8.8.8 or 1.1.1.1) they don't resolve
# cdwifi.cz. If you don't want to use their DNS set via DHCP for all your traffic
# the workaround here is to query their DNS server at the gateway just
# for this request.
#
@tgrk
tgrk / index.js
Last active June 25, 2017 13:18
Dark theme override for Slack
document.addEventListener("DOMContentLoaded", function() {
// Then get its webviews
let webviews = document.querySelectorAll(".TeamView webview");
// Fetch our CSS in parallel ahead of time
const cssPath = 'https://cdn.rawgit.com/widget-/slack-black-theme/master/custom.css';
let cssPromise = fetch(cssPath).then(response => response.text());
let customCustomCSS = `
@tgrk
tgrk / prepare-commit-msg
Last active September 8, 2016 10:32
Just put this to your repo (.git/hooks/prepare-commit-msg) that follows convention of prefixing branch with JIRA ticket ID
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
### Keybase proof
I hereby claim:
* I am tgrk on github.
* I am tgrk (https://keybase.io/tgrk) on keybase.
* I have a public key whose fingerprint is AC2A 7383 8D14 2771 D666 72EC 38D0 AC14 97F3 A51A
To claim this, I am signing this object:
@tgrk
tgrk / dvtv_fetch.py
Last active May 26, 2016 17:30
Simple fetcher of DVTV videos from www.aktualne.cz
#!/usr/bin/env python
import os
import sys
import urllib2
from urllib import urlencode
from unidecode import unidecode
from BeautifulSoup import BeautifulSoup as bs
def fetch_video(url):
@tgrk
tgrk / service-checklist.md
Created October 7, 2015 21:42 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
-module(sliding_window).
-compile(export_all).
-include_lib("eunit/include/eunit.hrl").
-record(state, {dataset :: list(pos_integer()),
position :: pos_integer(),
window_length :: pos_integer()}).
@tgrk
tgrk / gist:cd4aacb6f8a830e87736
Created October 13, 2014 13:44
Find Session Buddy extension path
def find_extension_path():
path = None
extensions_dir = os.path.join(expanduser("~"),
".config/google-chrome/Default/Extensions/")
for dirname, dirnames, filenames in os.walk(extensions_dir):
for subdirname in dirnames:
manifest_file = os.path.join(dirname, subdirname, "manifest.json")
if os.path.isfile(manifest_file):
with open(manifest_file) as data:
json_data = json.load(data)
#!/usr/bin/python
import sys
import soundcloud
# configuration
client_id = ""
client_secret = ""
client_username = ""
client_password = ""
@tgrk
tgrk / history.txt
Created January 15, 2014 19:47 — forked from oxtopus/history.txt
sudo apt-get update
sudo apt-get install python-dev git python-pip automake libtool libssl-dev
git clone https://github.com/numenta/nupic.git
mkdir -p nta/eng
echo "
export NTA=$HOME/nta/eng
export NUPIC=$HOME/nupic
export BUILDDIR=/tmp/ntabuild
export MK_JOBS=3
source $NUPIC/env.sh" >> ~/.bashrc