Skip to content

Instantly share code, notes, and snippets.


CHANN channprj

View GitHub Profile
ypereirareis /
Last active Aug 19, 2016
Script to wait for a host to become available locally
wait_single_host() {
local host=$1
local port=$1
echo "==> Check host ${host}:${port}"
while ! nc ${host} ${port} > /dev/null 2>&1 < /dev/null; do echo " --> Waiting for ${host}:${port}" && sleep 1; done;
fetep / genhttplogs.rb
Created Mar 14, 2012
apache log generator
View genhttplogs.rb
class IPGenerator
def initialize(session_count, session_length)
@session_count = session_count
@session_length = session_length
@sessions = {}
Nesffer / bot.js
Created Nov 3, 2016
Telegram Bot Shell
View bot.js
const shell = require('./modules/shell');
var shellRegex = new RegExp('^/shell(' + BOTNAME + ')?$', 'i');
bot.onText(shellRegex, (msg, match) => {
var messageId = msg.message_id;
var chatId =;
var fromId =;
var opts = {
reply_markup: JSON.stringify({force_reply: true, selective: true}),
reply_to_message_id: messageId
kimdwkimdw /
Last active Jul 25, 2017
Python 2.x Encoding cheatsheet
matthewriley /
Created May 12, 2017
Install Git 2.13.0 from source on RHEL 7.x

Install Git 2.13.0 from source on RHEL 7.x

These are the Terminal commands I recently used (June 2016) to install Git 2.13.0 from source on RHEL 7.x. I ran this in a VirtualBox VM after a fresh install from the ISO.

You mileage will vary as the yum packages are updated over time. The yum install line below should include all the dependencies, at least it did for me. Depending upon how often you use yum update you may need to run yum --enablerepo=base clean metadata as su before you run the following commands.

cd ~/Downloads
yum install autoconf cpio curl-devel expat-devel gcc gettext-devel make openssl-devel perl-ExtUtils-MakeMaker zlib-devel
wget -O v2.13.0.tar.gz
dahlia /
Last active May 4, 2018
Print SQLAlchemy queries (including bind params).
"""Print SQLAlchemy queries (including bind params).
See also:
def show_query(query):
qc = query.statement.compile(
Sepero /
Created Mar 26, 2012 — forked from gregplaysguitar/
Remove slashs in django - like APPEND_SLASH but opposite.
""" Author contact: sepero 111 @ gmail . com """
from django import http
from django.utils.http import urlquote
from django.core import urlresolvers
class RemoveSlashMiddleware(object):
This middleware works like django's built in APPEND_SLASH, but in reverse. Eg
blainerothrock / gen.swift
Last active Jul 12, 2018
A Very Simple Genetic Algorithm Written in Swift 3
View gen.swift
#!/usr/bin/env xcrun swift -O
gen.swift is a direct port of cfdrake's from Python 2.7 to Swift 3
-------------------- ---------------------
gen.swift implements a genetic algorithm that starts with a base
population of randomly generated strings, iterates over a certain number of
generations while implementing 'natural selection', and prints out the most fit
The parameters of the simulation can be changed by modifying one of the many
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
LucaTNT / iTunes-now-playing-on-TouchBar.scpt
Last active Sep 27, 2018
his script can be used in conjunction with Better Touch Tool to display the currently playing track in iTunes on the MacBook Pro TouchBar. More info here:
View iTunes-now-playing-on-TouchBar.scpt
-- This script can be used in conjunction with Better Touch Tool to display the currently playing track on the MacBook Pro TouchBar
-- More info here:
if application "iTunes" is running then
tell application "iTunes"
if player state is playing then
return (get artist of current track) & " - " & (get name of current track)
return ""
end if