Skip to content

Instantly share code, notes, and snippets.

View minhoryang's full-sized avatar
😍
Happy Today!

Minho Ryang minhoryang

😍
Happy Today!
View GitHub Profile
@lrstanley
lrstanley / jsonapi-v2.py
Last active August 29, 2015 13:56
JSONAPI basic HTTP Python API
#!/usr/bin/python
import json
from hashlib import sha256
from urllib2 import urlopen
from urllib import quote
# https://github.com/alecgorge/jsonapi/wiki/Analyzing-the-jsonapi-request-and-response-format
# http://alecgorge.github.io/jsonapi/
# NEW API USAGE: http://mcjsonapi.com/apidocs/
<meta name="viewport" content="width=device-width">
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.0.js"></script>
<style>
#in { width: 500px; }
</style>
<input type="text" id="in">
<div id="out"></div>
<script>
sock = new WebSocket('ws://baro.sl:7942/wakana');
//sock = new WebSocket('ws://baro.sl:8765/wakana');
@jaredgrubb
jaredgrubb / ManageSlavesBuilder.py
Last active August 29, 2015 14:00
Buildbot slave management via the Web UI (Buildbot 0.8.8+)
##
## "Manage Slaves" builder for buildbot:
## - a buildbot builder that can start/stop/restart any buildslave
## - runs simple shell script on slave to do the action
##
## ### INSTRUCTIONS ###
##
## On each slave, install the buildmaster's public SSH key so the buildmaster can SSH in.
## Then, add a script like the one below to each buildslave. A few notes on this script:
## - "bash -l" seems to be important in order to get the virtualenv to take correctly
#!/bin/bash
#dcc-swall-001 8080
current_proxy=`gsettings list-recursively | grep -i "proxy mode" | awk '{print $3}'`
action=$(yad --width 300 --skip-taskbar --title "Proxy Mode Select" \
--mouse \
--text "Current Proxy Setting: $current_proxy" \
--button="manual:1" \
--button="auto:2" \
--button="none:3" \
/*
this simple snippets will give you downloadable url of soundcloud.
just slap soundcloud url like this way in csharp Download('Soundcloud url'); this will returned downloadable url
*/
public string Download(string songurl){
string returned = null;
HttpWebRequest hc = (HttpWebRequest)WebRequest.Create(songurl);
hc.UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36";
HttpWebResponse hresponse = (HttpWebResponse)hc.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(hresponse.GetResponseStream());
@rosskukulinski
rosskukulinski / cloud_config
Created October 10, 2014 23:25
CoreOS cloud_config for Rackspace Public Cloud
#cloud-config
coreos:
fleet:
public-ip: $public_ipv4
metadata: region=dfw,provider=rackspace
etcd:
discovery: https://discovery.etcd.io/youridhere
# multi-region and multi-cloud deployments need to use $public_ipv4
# We'll actually fill this in using fixup_etc.sh (see below)
# addr: $rax_privatenet_ipv4:4001
@IanVaughan
IanVaughan / go-slow.sh
Created October 11, 2014 22:06
Make your internet like the 80ies
#!/bin/bash
help() {
echo 'G o S L O W ...'
}
stop() {
sudo ipfw delete 1
sudo ipfw delete 2
sudo ipfw pipe 1 delete
@kouk
kouk / connect-to-agent.sh
Last active August 29, 2015 14:08
connect with gpg-agent (with ssh) at all costs
# Tries to connect to a running gpg-agent or starts one itself. It tries connecting to:
# 1. the agent currently designated in the environment,
# 2. the agent designated in the $HOME/.gnupg/gpg-agent-info file,
# 3. the most recently started running gpg-agent process, or last
# 4. a new gpg-agent process, with ssh support and, if applicable, x11 support.
#
# Step no. 3 requires the "pgrep" and "sockstat" utilities (available on FreeBSD)
CONNECTGPG=$(which gpg-connect-agent)
if [ -x $CONNECTGPG ] ; then
@usagi
usagi / 2014-11-19.md
Last active August 29, 2015 14:09
HTTP2: nghttp2_asioにウェブブラウザーでアクセスしてみる

ブログポストより綺麗(´・ω:;.:...

−−−−

HTTP2サーバーを組み込んだソフトウェアを開発しようと思うと、現在有力な選択肢は nghttp2h2o かなって思います。今回は nghttp2 をビルドして得られる libnghttp2_asio.so をリンクしたサーバーと、このサーバーをHTTP2で利用可能なクライアントとして Firefox 35 Developer Edition を使ってみます。

from ws4py.client.threadedclient import WebSocketClient
class DummyClient(WebSocketClient):
def opened(self):
print "Opened websocket"
def closed(self, code, reason=None):
print "Closed down", code, reason
def received_message(self, m):