Skip to content

Instantly share code, notes, and snippets.

View domguard's full-sized avatar

domguard

  • Europe occidentale
  • 03:41 (UTC +01:00)
View GitHub Profile
@domguard
domguard / gist:3832708
Created October 4, 2012 10:08
Cloning PG databases
pg_dump -h 172.26.76.100 -p 5432 -U username your_db | psql -h localhost -p 5432 -U username your_db
@domguard
domguard / gist:3040742
Created July 3, 2012 16:10
Using django.jQuery with another jQuery
(function($){
//console.log($.fn.jquery) // which jquery are we using ?
$(function(){
$("select[name$='-etype']").each(function(){
show_target_methods($(this));
});
$("select[name$='-etype']").bind("change",function(e){
console.log($(this));
@domguard
domguard / gist:3002507
Created June 27, 2012 08:45
Install SSH Keys
#!/bin/sh
USER="${1}"
HOST="${2}"
ALIAS="${3}"
if [ ! "${USER}" ] && [ ! "${HOST}" ] && [ ! "${ALIAS}" ]; then
echo
echo "Usage: installSSHKey username hostname alias"
echo
@domguard
domguard / gist:1414943
Created December 1, 2011 08:22
Start/stop jar file from the command line
java -DSTOP.PORT=8079 -DSTOP.KEY=secret -jar start.jar
java -DSTOP.PORT=8079 -DSTOP.KEY=secret -jar start.jar --stop
@domguard
domguard / reset sequences pgsql
Created December 1, 2011 08:21
Remettre les séquences à zéro sur PostGreSQL
/usr/bin/psql --host localhost --port 5432 --username db_owner db_name
CREATE OR REPLACE FUNCTION "reset_sequence" (tablename text) RETURNS "pg_catalog"."void" AS
$body$
DECLARE
BEGIN
EXECUTE 'SELECT setval( '''
|| tablename
|| '_id_seq'', '
|| '(SELECT id + 1 FROM "'