Skip to content

Instantly share code, notes, and snippets.

View channprj's full-sized avatar

Heechan Park channprj

View GitHub Profile
@LucaTNT
LucaTNT / Spotify-now-playing-on-TouchBar.scpt
Last active September 27, 2018 09:51
This script can be used in conjunction with Better Touch Tool to display the currently playing track in Spotify 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 "Spotify" is running then
tell application "Spotify"
if player state is playing then
return (get artist of current track) & " - " & (get name of current track)
else
return ""
end if
@cansadadeserfeliz
cansadadeserfeliz / pipeline.py
Last active December 10, 2018 21:03
Django: python-social-auth configuration and pipeline to get users email, full name and save avatar for Facebook, Twitter, LinkedIn and Google http://blog.vero4ka.info/blog/2015/03/02/django-python-social-auth-configuration-and-pipeline-to-get-users-information/
def update_user_social_data(strategy, *args, **kwargs):
"""Set the name and avatar for a user only if is new.
"""
print 'update_user_social_data ::', strategy
if not kwargs['is_new']:
return
full_name = ''
backend = kwargs['backend']

Docker로 Caffe 실습하기

글쓴이: 김정주(haje01@gmail.com)

Caffe는 강력한 딥러닝 툴이지만, 설치가 까다로워 접근하기가 쉽지 않습니다. 이에 Docker를 활용하여 실습하는 방법을 소개합니다.

Docker 설치

설치과정은 많은 파일을 받아야 하기에 인터넷이 빠른 곳에서, 충분한 시간(2시간 이상)을 가지고 진행해야 합니다.

@ryubro
ryubro / Starbucks wifi login
Last active April 26, 2019 23:18
스타벅스 wifi 자동 로그인 북마클릿
var frm=document.pageForm;
var firstURL = "http://first.wifi.olleh.com/starbucks/index_en_new.html";
var secondURL = "https://first.wifi.olleh.com/starbucks/starbucks_en.php";
switch(window.location.href) {
case firstURL:
document.getElementById('stCheck').checked = false;
NextPage('0');
break;
case secondURL:
frm.cust_email_addr.value = Math.random().toString(36).replace(/[0-9\.]/g, "").substring(0,Math.floor(Math.random()*10)+2)+"@"+["yahoo.com","hotmail.com"][Math.floor(Math.random()*2)];
@vshank77
vshank77 / docker_aliases.sh
Last active April 29, 2019 09:01
Docker clean up commands
alias dockstart='docker-machine start default'
alias dockrestart='docker-machine restart default'
alias dockstop='docker-machine stop default'
alias dock='eval "$(docker-machine env default)"'
alias dockswm='eval "$(docker-machine env -swarm swarm-master)"'
alias dps='docker ps -a'
alias dqf='docker images -qf "dangling=true"'
alias ddqf='docker rmi -f $(docker images -qf "dangling=true")'
alias ddrmi='docker rmi -f $(docker images | grep -e "latest" -e "SNAPSHOT" | awk '"'"'{print $3}'"'"')'
alias dimg='docker images'
@landau
landau / hashmap.py
Created August 17, 2013 23:39
Hashmap in python
class Hashmap(object):
"""
character holding hash map
"""
def __init__(self, hash_fn, length=100):
assert hasattr(hash_fn, '__call__'), 'You must provide a hash function'
self._buckets = [None] * length
self.hash_len = length
self.hash_fn = hash_fn
@yosemitebandit
yosemitebandit / xls_to_json.py
Created April 3, 2015 03:28
converting xls files to JSON dicts in python
"""XLS -> json converter
first:
$ pip install xlrd
then:
$ cat in.xls
date, temp, pressure
Jan 1, 73, 455
Jan 3, 72, 344
@ericxyan
ericxyan / TICKvsELK.md
Last active April 28, 2020 02:35
TICK Stack vs ELK Stack

TICK Stack

Solution for collecting, storing, visualizing and alerting on time-series data at scale. All components of the platform are designed to work together seamlessly.

  • Telegraf: Collects time-series data from a variety of sources
  • InfluxDB:
  • Chronograf: Visualizes and graphs
  • Kapacitor: Alerting, ETL and detects anomalies in time-series data

Why Influx?

  • Open Source - MIT
  • Integrated - Data collection, storage, visualization and alerting
@shazron
shazron / gist:1725083
Created February 2, 2012 18:49
PhoneGap/Cordova: Open a url in the same UIWebView programmatically
function openInWebView(url)
{
var anchor = document.createElement('a');
anchor.setAttribute('href', url);
//anchor.setAttribute('target', '_self');
var dispatch = document.createEvent('HTMLEvents')
dispatch.initEvent('click', true, true);
anchor.dispatchEvent(dispatch);
@omarryhan
omarryhan / Sanic-Gino-Alembic migrations Setup
Last active May 30, 2020 15:49
Sanic/Gino/Alembic migrations
# Do the first 6 steps only once.
1. pip install --user alembic
2. bash: ``cd {{my_project}} && alembic init alembic``
3. bash: ``text_editor {{my_project}}/alembic.ini``
4. Change: "sqlalchemy.url = postgres://{{username}}:{{password}}@{{address}}/{{db_name}}"
5. bash: ``text_editor {{my_project}}/alembic/env.py``
6. Now, import your metadata/db object from your app.:
# {{my_project}}/{{my_project_dir}}/app.py