Skip to content

Instantly share code, notes, and snippets.

@goncha
goncha / postgres_queries_and_commands.sql
Created April 10, 2020 00:04 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- 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 October 11, 2014 02:08
Encrypt password in source control
.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 August 29, 2015 14:04
build.gradle for SpringMVC
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 July 19, 2014 05:20
ffmpeg video conversion
@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 August 29, 2015 14:03
Embed cuesheet in flac file
#!/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 August 29, 2015 14:01
build.gradle including dependency management (provided, exclude, files), svn info, sources jar
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 August 27, 2013 05:19
Pull voanews mp3 files
#!/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 August 24, 2013 11:33
Emacs Lisp script to merge articles from www.paulgraham.com into one single html.
;; 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 August 12, 2013 05:31
Haproxy naming based dispatch
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 December 20, 2015 14:39
Fedora 20 Setup

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