Skip to content

Instantly share code, notes, and snippets.

View beregond's full-sized avatar

Szczepan Cieślik beregond

View GitHub Profile
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active November 17, 2024 13:10
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%'
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active November 9, 2024 08:57
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@xeoncross
xeoncross / timezone.php
Created September 8, 2011 18:43
The perfect TimeZone selectbox list for PHP 5.3+
<?php
$regions = array(
'Africa' => DateTimeZone::AFRICA,
'America' => DateTimeZone::AMERICA,
'Antarctica' => DateTimeZone::ANTARCTICA,
'Aisa' => DateTimeZone::ASIA,
'Atlantic' => DateTimeZone::ATLANTIC,
'Europe' => DateTimeZone::EUROPE,
'Indian' => DateTimeZone::INDIAN,
'Pacific' => DateTimeZone::PACIFIC
URL Page_Title Date Transcript Img_Title Img_URL Keywords from http://www.andromedayelton.com/dckx.php
http://xkcd.com/1 Barrel - Part 1 [[A boy sits in a barrel which is floating in an ocean.]] Boy: I wonder where I'll float next? [[The barrel drifts into the distance. Nothing else can be seen.]] {{Alt: Don't we all.}} Don't we all. http://imgs.xkcd.com/comics/barrel_cropped_(1).jpg
http://xkcd.com/2 Petit Trees (sketch) [[Two trees are growing on opposite sides of a sphere.]] {{Alt-title: 'Petit' being a reference to Le Petit Prince, which I only thought about halfway through the sketch}} 'Petit' being a reference to Le Petit Prince, which I only thought about halfway through the sketch http://imgs.xkcd.com/comics/tree_cropped_(1).jpg
http://xkcd.com/3 Island (sketch) [[A sketch of an Island]] {{Alt:Hello, island}} Hello, island http://imgs.xkcd.com/comics/island_color.jpg
http://xkcd.com/4 Landscape (sketch) [[A sketch of a landscape with sun on the horizon]] {{Alt: There's a river flowing through the ocea