Skip to content

Instantly share code, notes, and snippets.

@nhandl3
nhandl3 / list_dependencies.md
Created November 8, 2018 04:04
Go (lang) useful commands

List directly imported packages

go list -f '{{ join .Imports "\n" }}'

List all subdependencies

go list -f '{{ join .Deps "\n" }}'

@nhandl3
nhandl3 / clone_db.sql
Last active September 5, 2015 04:17
PostgreSQL queries
-- http://stackoverflow.com/questions/876522/creating-a-copy-of-a-database-in-postgresql
CREATE DATABASE newdb WITH TEMPLATE currentdb OWNER dbuser;
@nhandl3
nhandl3 / watermark-text.sh
Last active December 25, 2015 04:09
imagemagic, command line watermark text into image
# make stamp
convert -size 300x50 xc:grey30 -font Arial -pointsize 50 -gravity center \
-draw "fill grey70 text 0,0 'SomeText'" \
stamp_fgnd.png
convert -size 300x50 xc:black -font Arial -pointsize 50 -gravity center \
-draw "fill white text 1,1 'SomeText' \
text 0,0 'SomeText' \
fill black text -1,-1 'SomeText'" \
+matte stamp_mask.png
composite -compose CopyOpacity stamp_mask.png stamp_fgnd.png stamp.png
<?php
define('DB_NAME' , 'dbname' );
define('DB_USER' , 'user' );
define('DB_PASSWORD', 'pwd' );
define('DB_HOST' , 'localhost');
$con=mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD);
// Check connection
if (mysqli_connect_errno())
{
<?php
$zip = new ZipArchive;
$res = $zip->open('file.zip');
if ($res === TRUE) {
$zip->extractTo('/myzips/extract_path/');
$zip->close();
echo 'woot!';
} else {
echo 'doh!';
}