Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
#-------------------------------------------------
# file: twitcher.py
# author: Florian Ehmke
# description: dmenu for twitch streams
#-------------------------------------------------
import argparse
import requests
from subprocess import Popen, PIPE, STDOUT
@aCandidMind
aCandidMind / gist:8772d1278620f5a88f34158dfdfea7a4
Created September 11, 2017 13:18 — forked from anonymous/gist:5101448
Coupling - mock,stub
class RequestsSchedule
def fetch_all_expired
# fetch and return all expired definitions from MongoDB
# e.g. use MongoClient somehow
end
end
class RequestToQueuePusher
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@aCandidMind
aCandidMind / clear_tags.rb
Created January 25, 2017 21:12 — forked from lfbittencourt/clear_tags.rb
This Ruby script removes all local and remote tags in a single-line way, so you don't need supply your credentials several times. Optionally, you can remove only tags greater than a specific version.
#!/usr/bin/env ruby
# Only tags >= min_tag will be removed.
min_tag = '0.0.0'
tags = `git tag`.split(/\s+/).select do |t|
Gem::Version.new(t) >= Gem::Version.new(min_tag)
end
`git tag -d #{tags.join ' '}`
`git push origin #{tags.map { |t| ':' + t }.join ' '}`
@aCandidMind
aCandidMind / save-load-docker-images.sh
Created August 31, 2016 15:02 — forked from mmrko/save-load-docker-images.sh
Script to (selectively) save/load multiple Docker images
#!/usr/bin/env bash
# Script to (selectively) save/load multiple Docker images to/from a directory.
# Run ./save-load-docker-images.sh for help.
set -e
directory=$PWD
filter=""
@aCandidMind
aCandidMind / ruby-no-cflags.txt
Created June 29, 2016 08:27 — forked from inkel/ruby-no-cflags.txt
Benchmark for comparison of homebrew's ruby with and without CFLAGS="-march=native -O3"
>> /usr/bin/time -l ruby thebench.rb 30 1000
Rehearsal --------------------------------------------------------
fib(30) 0.260000 0.000000 0.260000 ( 0.255475)
1000 tempfiles 0.120000 0.250000 0.370000 ( 0.429621)
----------------------------------------------- total: 0.630000sec
user system total real
fib(30) 0.260000 0.000000 0.260000 ( 0.259108)
1000 tempfiles 0.130000 0.270000 0.400000 ( 0.848950)
@aCandidMind
aCandidMind / events.js
Created June 13, 2016 13:39 — forked from findjashua/events.js
Get streams for interaction & mutation events
import {Observable} from 'rx';
import {DOM} from 'rx-dom';
import {toArray, getNodesFromSelector} from './utils';
let interactions_ = {
'click': Observable.fromEvent(document.body, 'click')
}
let mutations_ = DOM
@aCandidMind
aCandidMind / add-docker-user.sh
Created June 2, 2016 16:40 — forked from bruth/add-docker-user.sh
Setup Official Docker Repo on RHEL 7
#!/bin/bash
/usr/sbin/usermod -aG docker <user>
@aCandidMind
aCandidMind / gist:52a0161d476a1f42154352c9614a2d82
Last active May 17, 2016 08:35 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git pull # very important, as per https://gist.github.com/lttlrck/9628955#gistcomment-1440927
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote