Skip to content

Instantly share code, notes, and snippets.

View channprj's full-sized avatar

Heechan Park channprj

View GitHub Profile
@channprj
channprj / cntAllsessionStorageValues.js
Last active March 8, 2017 06:57
Count all of sessionStorage values.
var cnt = 0;
for(var i=0; i < sessionStorage.length; i++){
if (JSON.parse(sessionStorage.getItem(sessionStorage.key(i))).length > 0) {
cnt = cnt + JSON.parse(sessionStorage.getItem(sessionStorage.key(i))).length;
}
}

Postgresql Cheat Sheet

'SHOW FULL PROCESSLIST;' in postgres

SELECT * FROM pg_stat_activity;

Init auto incremental index

ALTER SEQUENCE check_hrpcs_module_idx_seq RESTART WITH 1;

Export table to CSV file

\COPY tablename TO '';

@channprj
channprj / mercurial.md
Last active March 21, 2017 07:58
Mercurial Cheat Sheet

Mercurial Cheat Sheet

This is cheatsheet for personal purpose.

Commit as different user

hg commit --config ui.username= -m ""

@channprj
channprj / colored_logging.py
Created March 29, 2017 01:39 — forked from hit9/colored_logging.py
colored python logging. And add a level 'success'
class Color(object):
"""
utility to return ansi colored text.
"""
colors = {
'black': 30,
'red': 31,
'green': 32,
'yellow': 33,
@channprj
channprj / control_rpi2_built-in_leds.md
Last active July 12, 2017 19:42
RPi2 내장 LED 컨트롤

RPi2 내장 LED 컨트롤하기

라즈베리파이2 내장 LED 관련 모듈은 /sys/class/leds/ 에 있음.

  • OK (ACT) LED = led0
  • Power (PWR) LED = led1

계속 켜져있거나 깜박이는 것이 거슬릴 경우 루트 계정으로 아래와 같이 간단히 제어가 가능.

# Green LED
@channprj
channprj / googleCustomShortcut.js
Last active August 4, 2017 12:51
Google Custom Shortcuts
// ==UserScript==
// @name Add Keyboard shortcuts for Google Search
// @namespace CHANN
// @description Adds '/' key as shortcut for accessing Google search bar
// @include https://www.google.*
// @version 0.1
// @grant none
// ==/UserScript==
window.addEventListener("keyup", function(event) {
@channprj
channprj / openInChrome.js
Created August 31, 2017 09:52
Add this in iPhone Safari app when you're wanna open current page in Chrome
javascript:location.href=%22googlechrome%22+location.href.substring(4);
@channprj
channprj / README-Template.md
Created September 8, 2017 08:11 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@channprj
channprj / voices.txt
Created October 16, 2017 17:33 — forked from mculp/voices.txt
List of voices available by the `say` command on OS X
Agnes en_US # Isn't it nice to have a computer that will talk to you?
Albert en_US # I have a frog in my throat. No, I mean a real frog!
Alex en_US # Most people recognize me by my voice.
Alice it_IT # Salve, mi chiamo Alice e sono una voce italiana.
Alva sv_SE # Hej, jag heter Alva. Jag är en svensk röst.
Amelie fr_CA # Bonjour, je m’appelle Amelie. Je suis une voix canadienne.
Anna de_DE # Hallo, ich heiße Anna und ich bin eine deutsche Stimme.
Bad News en_US # The light you see at the end of the tunnel is the headlamp of a fast approaching train.
Bahh en_US # Do not pull the wool over my eyes.
Bells en_US # Time flies when you are having fun.
@channprj
channprj / enableDragContext.js
Last active October 25, 2017 20:59
[Work in Progress] Simple Drag and Drop Enabler
javascript:void(document.onselectstart=null);
javascript:void(document.oncontextmenu=null);