Skip to content

Instantly share code, notes, and snippets.

View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@goncha
goncha / Makefile
Created Oct 11, 2014
Encrypt password in source control
View Makefile
.PHONY: _pwd_prompt decrypt_conf encrypt_conf
CONF_FILE=conf/settings.json
# 'private' task for echoing instructions
_pwd_prompt:
@echo "Contact jeresig@gmail.com for the password."
# to create conf/settings.json
decrypt_conf: _pwd_prompt
@goncha
goncha / build-1.gradle
Last active Aug 29, 2015
build.gradle for SpringMVC
View build-1.gradle
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'java'
project.version = "1.0"
try {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'svn'
@goncha
goncha / ffmpeg2mp4.cmd
Created Jul 19, 2014
ffmpeg video conversion
View ffmpeg2mp4.cmd
@echo off
D:\ffmpeg\bin\ffmpeg.exe -i %1 -f mp4 -c:v mpeg4 -b:v 2000k -g 300 -bf 2 -pass 1 -an -f rawvideo -y NUL
D:\ffmpeg\bin\ffmpeg.exe -i %1 -f mp4 -c:v mpeg4 -b:v 2000k -g 300 -bf 2 -pass 2 -c:a copy %2
@goncha
goncha / embed_cue.sh
Last active Aug 29, 2015
Embed cuesheet in flac file
View embed_cue.sh
#!/bin/sh
FLAC="${1:-Disc.flac}"
CUE="${FLAC%%.flac}.cue"
if [ ! -r "$CUE" ]
then
echo "Cannot read '$CUE'"
exit 1
@goncha
goncha / build.gradle
Last active Aug 29, 2015
build.gradle including dependency management (provided, exclude, files), svn info, sources jar
View build.gradle
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'java'
project.version = "1.0"
try {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'svn'
@goncha
goncha / pull_voanews.sh
Created Aug 27, 2013
Pull voanews mp3 files
View pull_voanews.sh
#!/bin/sh
cd $HOME/public_html/voanews
SENEWS=$(date '+%y%m%d')_SE_NEWS.mp3
HLNEWS=$(date '+%y%m%d')_HL_NEWS.mp3
wget -O "${SENEWS}" \
"http://www.voanews.com/mp3/voa/english/spec/SPECIAL_ENGLISH_NEWS.mp3"
@goncha
goncha / paulgraham.el
Created Aug 24, 2013
Emacs Lisp script to merge articles from www.paulgraham.com into one single html.
View paulgraham.el
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
(setq temp-articles '(
"progbot.html"
"lwba.html"
"avg.html"
"javacover.html"
"popular.html"
@goncha
goncha / haproxy-naming-based-dispatch.conf
Created Aug 12, 2013
Haproxy naming based dispatch
View haproxy-naming-based-dispatch.conf
backend host1
mode http
server inst1 host1:port1
backend host2
mode http
server inst1 host2:port2
frontend http-in
bind :80
@goncha
goncha / fedora-setup.org
Last active Dec 20, 2015
Fedora 20 Setup
View fedora-setup.org

System

  1. Disable SELinux in `/etc/selinux/config` (need reboot)
  2. Install RPMFusion free&nofree repos rpm
  3. Install Wifi BCM4313 driver `yum install kmod-wl` after Step 2
  4. Install Adobe and Google repos rpm
  5. Install 163 mirror repos (http://mirrors.163.com/.help/fedora.html)
  6. Install build-essential alternative, `yum install make automake gcc gcc-c++ kernel-devel` or `yum-builddep sqlite` or `yum groupinstall “Development Tools”`
  7. Configure yum use proxy in /etc/yum.conf