Skip to content

Instantly share code, notes, and snippets.

View koorukuroo's full-sized avatar
🎯
Focusing

Kyunghoon Kim koorukuroo

🎯
Focusing
View GitHub Profile
@yamakk
yamakk / nx_pylab.py.patch
Created September 28, 2011 07:40
patch for enables function draw_networkx_edge_labels to set fontproperties.
--- networkx-1.5/networkx/drawing/nx_pylab.py 2011-06-04 09:45:38.000000000 +0900
+++ nx_pylab.py 2011-10-01 01:48:06.000000000 +0900
@@ -21,7 +21,8 @@
# All rights reserved.
# BSD license.
-__all__ = ['draw',
+__all__ = ['set_fontproperties',
+ 'draw',
'draw_networkx',
@adamalton
adamalton / template.html
Last active December 16, 2015 06:09
Example of pagination on Google App Engine which allows going back a page
<h1>Page 1</h1>
<a href="/myview/?page={{previous_page_number}}">Previous page</a>
<a href="/myview/?page={{next_page_number}}">Next page</a>
{% for object in results %}
{{object}} {#whatever you're displaying #}
{% endfor %}

Docker 치트 시트

왜 Docker를 사용해야하는가?

Why Should I Care (For Developers)

"나에게 Docker의 매력은 간단히 격리된 환경을 만들 수 있다는 것과, 그러한 환경을 재사용할 수 있다는 점이다."런타임 환경을 한 번 만들어 패키지로 만들면, 이 패키지를 다른 어떤 머신에서도 다시 사용할 수 있다. 또한 여기서 실행되는 모든 것은 마치 가상머신과 같이 호스트로부터 격리되어있다. 무엇보다도 이런 모든 일들이 빠르고 간단히 가능하다.

TL;DR, 지금 바로 Docker 개발 환경 구축하기

@imlucas
imlucas / add_users.py
Created April 12, 2012 12:58
Using Amazon Cloudsearch with Python and Boto
from cloudsearch import connect_cloudsearch, get_document_service
endpoint = 'paste your doc service endpoint here'
service = get_document_service(endpoint=endpoint) # Get a new instance of cloudsearch.DocumentServiceConnection
# Presumably get some users from your db of choice.
users = [
{
'id': 1,
@xadhix-zz
xadhix-zz / Facebook Lookback Downloader
Created February 4, 2014 12:18
Extracts the HD video link from the Facebook lookback page.
var xLBD = {};
xLBD.c = function (){
xLBD.f = unescape(document.querySelector("[flashvars]").getAttribute("flashvars")).substring(7);
xLBD.f = JSON.parse(xLBD.f.substring(0, xLBD.f.lastIndexOf("}") + 1)).video_data[0].hd_src;
xLBD.a = "<div style='position:absolute;top:100px;height:300px;left:15%;background:#fff;border:10px solid #000;font-size:5em;padding:100px;'>Click <a download='lookback.mp4' href='"+xLBD.f+"'>here<\/a> to download your lookBack video.</div>";
document.body.innerHTML += xLBD.a;
}
if(document.readyState == "complete")
xLBD.c();
else window.onload = xLBD.c;
@bnlucas
bnlucas / example.txt
Last active August 2, 2020 21:57
Full Text Searching with the Google App Engine Search API. Using with Flask to demonstrate.
When going to /search/artist/<query_string> using the documents below you get:
/search/artist/m - this returns both Macklemore and Against Me!
/search/artist/a - this returns both Against Me! and AWOLNATION
/search/artist/ma - this returns only Macklemore
/search/artist/aw - this returns only AWOLNATION
/search/artist/me - this returns only Against Me!
Adding 'AWOLNATION' to models.Artist produces:
@alexbowe
alexbowe / nltk-intro.py
Created March 21, 2011 12:59
Demonstration of extracting key phrases with NLTK in Python
import nltk
text = """The Buddha, the Godhead, resides quite as comfortably in the circuits of a digital
computer or the gears of a cycle transmission as he does at the top of a mountain
or in the petals of a flower. To think otherwise is to demean the Buddha...which is
to demean oneself."""
# Used when tokenizing words
sentence_re = r'''(?x) # set flag to allow verbose regexps
([A-Z])(\.[A-Z])+\.? # abbreviations, e.g. U.S.A.
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@rabelais88
rabelais88 / docker-swarm.md
Created November 10, 2019 05:18
스타트업에 traefik + docker-swarm을 추천하는 이유

스타트업에 traefik + docker-swarm을 추천하는 이유

  • Traefik: Reverse-proxy router
  • Docker-swarm: Docker-supported orchestrator

왜 Docker-Swarm인가?

  • kubernetes(이하 k8) 는 무겁고 느리다. docker-swarm(이하 DS)docker 최신버전에 기본으로 탑재되어 나온다. 또한 helm이나 별도의 관리 cli(kubeadm, kubectl)를 설치할 필요가 없다.

  • k8 은 세팅도 어렵다: 세팅하기가 워낙 까다로워 실제로 운영하기 적절한 경우는 devops 팀을 가진 최소 20명 이상의 대규모 사이즈 팀이다. 한 명이 작업하는 것이 아주 불가능한 것은 아니지만, 긴급수정시에는 많이 위험해질 수 있다. 총원이 10명이 되지 않는 우리팀 같은 경우는 한 사람이 급하게 기능수정을 해야될 일이 많다.

@rondomondo
rondomondo / check_jwt_sig.py
Last active February 21, 2024 14:55
Two methods/examples of how to decode and verify the signature of AWS cognito JWT web tokens externally. This uses RSA key pair and alternatively PKCS1_v1_5. See https://gist.github.com/rondomondo/efff911f2c41c295e23415e94e12b8d3 for example of signing and verification by downloading an ISSUERS PKI SSL certificate from the signers website, and h…
#!/usr/bin/env python
import os
import time
import json
import base64
import requests
import argparse
from base64 import urlsafe_b64decode, b64decode
from Crypto.Hash import SHA256, SHA512