This is a collection of all kinds of tips that I found to be useful over the years as most of them reflect repetative tasks but that are seldom applied. As a human... I forget. This list will soon be merge with a much longer and older list and then, I guess, I will publish it maybe as gist on Github or part of my dot-files Git repository.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Keychain(): | |
"""Reimplementation of Keyring for OS X. | |
Problem with Keyring is it doesn't allow to set a label with is required | |
for this use case. | |
""" | |
class KeychainError(Exception): | |
def __init__(self, code=None, msg=None, cause=None): | |
self.code = code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import base64 | |
import hashlib | |
import hmac | |
import struct | |
import sys | |
import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Dependencies: $ brew install oath-toolkit | |
function connect { | |
service="$1" | |
password='123456' | |
secret=$(cat $HOME/.google_authenticator) | |
totp=$(oathtool --base32 --totp $secret) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import hmac, struct, time, base64, hashlib # for totp generation | |
import re, sys, subprocess # for general stuff | |
from getopt import getopt, GetoptError # pretending to be easy-to-use | |
# | |
# gtb - Google(auth) + Tunnelblick | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import argparse | |
import os | |
import sys | |
import traceback | |
__version__ = '1.0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[com.keminglabs.zmq-async.core :refer [register-socket!]] | |
'[clojure.core.async :refer [>! <! <!! >!! go chan sliding-buffer close!]]) | |
(let [addr "tcp://*:9999" | |
[s-in s-out] (repeatedly 2 #(chan (sliding-buffer 64)))] | |
(register-socket! {:in s-in :out s-out :socket-type :rep | |
:configurator (fn [socket] (.bind socket addr))}) | |
(println "waiting messages...") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import cookielib | |
import getpass | |
import HTMLParser | |
import re | |
import sys | |
import urllib | |
import urllib2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
youtube-dl -i -w -q https://www.youtube.com/playlist?list=PLBXmeocYXDfCFnkCoxkSpFChle3gmidEn | |
youtube-dl -i -w -q https://www.youtube.com/playlist?list=PLOcrXzpA0W82rsJJKrmeBlY3_MS0uQv3h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [xs (map #(Thread/sleep (* % 1000)) [1 9])] | |
(doseq [x xs] | |
(print x))) |