Skip to content

Instantly share code, notes, and snippets.

View channprj's full-sized avatar

Heechan Park channprj

View GitHub Profile
@ypereirareis
ypereirareis / docker_wait_hosts.sh
Last active August 19, 2016 05:06
Script to wait for a host to become available locally
wait_single_host() {
local host=$1
shift
local port=$1
shift
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
fetep / genhttplogs.rb
Created March 14, 2012 15:32
apache log generator
#!/usr/bin/ruby
class IPGenerator
public
def initialize(session_count, session_length)
@session_count = session_count
@session_length = session_length
@sessions = {}
end
@nesffer
nesffer / bot.js
Created November 3, 2016 05:44
Telegram Bot Shell
const shell = require('./modules/shell');
var shellRegex = new RegExp('^/shell(' + BOTNAME + ')?$', 'i');
bot.onText(shellRegex, (msg, match) => {
var messageId = msg.message_id;
var chatId = msg.chat.id;
var fromId = msg.from.id;
var opts = {
reply_markup: JSON.stringify({force_reply: true, selective: true}),
reply_to_message_id: messageId
@kimdwkimdw
kimdwkimdw / guide.md
Last active July 25, 2017 14:11
Python 2.x Encoding cheatsheet
@matthewriley
matthewriley / Git2130onRHEL7x.md
Created May 12, 2017 03:08
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
su
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 https://github.com/git/git/archive/v2.13.0.tar.gz
@dahlia
dahlia / query_debug.py
Last active May 4, 2018 18:12
Print SQLAlchemy queries (including bind params).
"""Print SQLAlchemy queries (including bind params).
See also: http://docs.sqlalchemy.org/en/latest/faq/sqlexpressions.html#faq-sql-expression-string
"""
def show_query(query):
qc = query.statement.compile(
dialect=query.session.bind.dialect,
@Sepero
Sepero / slash_middleware.py
Created March 26, 2012 09:17 — forked from gregplaysguitar/slash_middleware.py
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
blainerothrock / gen.swift
Last active July 12, 2018 15:56
A Very Simple Genetic Algorithm Written in Swift 3
#!/usr/bin/env xcrun swift -O
/*
gen.swift is a direct port of cfdrake's helloevolve.py from Python 2.7 to Swift 3
-------------------- https://gist.github.com/cfdrake/973505 ---------------------
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
string.
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
LucaTNT / iTunes-now-playing-on-TouchBar.scpt
Last active September 27, 2018 09:51
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: https://lucatnt.com/2017/02/display-the-currently-playing-track-in-itunesspotify-on-the-touch-bar
-- 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: https://lucatnt.com/2017/02/display-the-currently-playing-track-in-itunesspotify-on-the-touch-bar
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)
else
return ""
end if