Skip to content

Instantly share code, notes, and snippets.

View ShinJJang's full-sized avatar
🎯
Focusing

shinjjang ShinJJang

🎯
Focusing
View GitHub Profile
@ShinJJang
ShinJJang / slackpost
Created October 12, 2015 16:16 — forked from dopiaza/slackpost
Post a message to a Slack channel
#!/bin/bash
# Usage: slackpost <token> <channel> <message>
# Enter the name of your slack host here - the thing that appears in your URL:
# https://slackhost.slack.com/
slackhost=PUT_YOUR_HOST_HERE
token=$1
@ShinJJang
ShinJJang / proxy_views.py
Created September 30, 2015 07:48 — forked from joeshaw/proxy_views.py
super-hacky flask proxy
# coding:utf-8
# Copyright 2011 litl, LLC. All Rights Reserved.
import httplib
import re
import urllib
import urlparse
from flask import Blueprint, request, Response, url_for
from werkzeug.datastructures import Headers
@ShinJJang
ShinJJang / kibana
Created September 15, 2015 09:50
kibana init.d
!/bin/bash
### BEGIN INIT INFO
# Provides: kibana
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Runs kibana daemon
# Description: Runs the kibana daemon as a non-root user
### END INIT INFO
# Process name
@ShinJJang
ShinJJang / data.yml
Created September 11, 2015 02:54
Result of elasticsearch watcher action mail
---
ctx:
metadata: null
watch_id: "log_error_watch"
payload:
_shards:
total: 2
failed: 0
successful: 2
hits:
@ShinJJang
ShinJJang / a1_solution.py
Created August 20, 2015 16:10
Fast campus web programming - assignment 1 solution
"""
Fast Campus Web Programming 6th
Assignment 1 Solution
----------------------
함수 호출은 첫번째 문제를 제외하고 주석처리 되어 있습니다.
실행해보시려면 주석을 제거해주세요.
idle이라면 직접 호출하셔도 됩니다.
"""
def reverse_string(user_input):
user_input = list(user_input)
@ShinJJang
ShinJJang / expression_to_int.py
Last active August 29, 2015 14:27
Python string expression to int
>>> int("2**10")
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
int("2**10")
ValueError: invalid literal for int() with base 10: '2**10'
>>> int(eval("2**10"))
1024
>>> eval("2.3**10")
// http://stackoverflow.com/questions/6835835/jquery-simple-polling-example
// @chrisjleu's anwser
(function poll() {
$.ajax({
url: "/api/thread/{id}/comments",
type: "GET",
success: function(data) {
console.log("polling");
// Render polling
render_polling();
@ShinJJang
ShinJJang / longPolling.js
Last active August 29, 2015 14:26 — forked from jasdeepkhalsa/longPolling.js
Simple Long Polling Example with JavaScript and jQuery by Tian Davis (@tiandavis) from Techoctave.com (http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery)
// Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast)
(function poll(){
$.ajax({ url: "server", success: function(data){
//Update your dashboard gauge
salesGauge.setValue(data.value);
}, dataType: "json", complete: poll, timeout: 30000 });
})();
@ShinJJang
ShinJJang / scraper.py
Last active August 29, 2015 14:26 — forked from cornchz/scraper.py
[PyConKR 2014] 30분만에 따라하는 동시성 스크래퍼
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from gevent import monkey; monkey.patch_all()
import re
from urlparse import urljoin
from gevent.pool import Pool
import requests
@ShinJJang
ShinJJang / vertualenv_python3_windows
Created July 31, 2015 07:59
windows python3 virtualenv
> pip3 install virtualenv # 3.x의 python library virtualenv 설치
> python3 -m venv myenv # python3 환경을 virtual environment를 myenv 폴더에 셋팅
> myenv\Scripts\activate.bat # python3 가상 환경을 적용
> deactivate.bat # 가상 환경 해제