Skip to content

Instantly share code, notes, and snippets.

View peterklipfel's full-sized avatar

Peter Klipfel peterklipfel

View GitHub Profile
@takezoe
takezoe / JSONSample.scala
Created December 30, 2011 15:02
Example of scala.util.parsing.json
import scala.util.parsing.json._
val result = JSON.parseFull("""
{"name": "Naoki", "lang": ["Java", "Scala"]}
""")
result match {
case Some(e) => println(e) // => Map(name -> Naoki, lang -> List(Java, Scala))
case None => println("Failed.")
}
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 4, 2024 11:47
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%'
@trinitronx
trinitronx / du_hsort.sh
Created June 4, 2013 21:22
Script to sort disk usage output by size
#!/bin/bash
# This line sorts first according to numerical size in bytes
# the second pass through du in the while loop converts to human readable
# format
du -s * | sort -n | cut -f 2- | while read a; do du -hs "$a"; done
@ogrrd
ogrrd / dnsmasq OS X.md
Last active July 3, 2024 08:40
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@kainam00
kainam00 / rvm-amazon-linux.bash
Created July 31, 2015 15:31
Install RVM on Amazon Linux
#!/bin/bash
# Install prerequisites
yum install -y gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel ruby-devel gcc-c++ jq git
# Import key
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
# Install RVM
curl -sSL https://get.rvm.io | bash -s stable --ruby