Skip to content

Instantly share code, notes, and snippets.

@gurjeet
gurjeet / gist:31c17ae70766f0de084f
Created June 25, 2014 15:07
PPAS bug: WARNING: unrecognized node type: 306
create table public.traffic_analysis(date_text text, load_avg_1_min double precision, hostname text not null, ts timestamp);
create type public.weekdays as enum (
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
@gurjeet
gurjeet / test_case
Created July 7, 2014 19:20
Postgres' join-based UPDATE updates just once instead of multiple times
/* Item names */
create table item (i_id int, i_name text);
/* Stock counts of items */
create table stock (s_i_id int, s_quantity int);
/* All rows here represent one order; each row is its line items */
create table order_line (ol_i_id int, ol_quantity int);
insert into item values(1, 'item 1');
@gurjeet
gurjeet / weird_interval_output
Last active August 29, 2015 14:03
Postgres Weird interval representation
postgres=# select '6 days 23:45:00'::interval - '6 days 23:23:00'::interval;
?column?
----------
00:22:00
(1 row)
postgres=# select '00:46:00'::interval - '00:24:00'::interval;
?column?
----------
00:22:00
[bart] #global section
backup_path = /path/to/backup/dir
pg_basebackup_path = /path/to/pg_basebackup
log_file= /path/to/logfile
[Server1] # name the server being configured.

Setting up Crashplan on FreeNAS Goals

Be able to backup from the FreeNAS box to offsite Crashplan Central. Allow incoming Crashplan backups from other devices. Install the CrashPlan plugin

Install the plugin into a jail: Click on Plugins, then the Available tab, the "crashplan" line and finally the Install button. Once the installation completes, on the left tree, expand Plugins and click on CrashPlan. Accept the Java EULA. Start the Crashplan plugin: Plugins->Installed and make sure the Crashplan plugin is in the "ON" position.

@gurjeet
gurjeet / sshd.go
Created January 3, 2017 22:32 — forked from nictuku/sshd.go
Go SSH server complete example
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"code.google.com/p/go.crypto/ssh"
"code.google.com/p/go.crypto/ssh/terminal"
@gurjeet
gurjeet / main.go
Last active September 22, 2022 05:43
Protect gorilla/mux Subroute with basic auth
package main
/*
* This Gist and it's other versions are from:
*
* https://stackoverflow.com/questions/42321789/unable-to-protect-gorilla-mux-subroute-with-basic-auth
*/
import (
"crypto/subtle"
@gurjeet
gurjeet / bet-on-coin-flip.markdown
Created December 2, 2017 15:45
Bet on Coin Flip
@gurjeet
gurjeet / index.html
Last active February 26, 2018 03:23
Vertical Bar Chart with Negative Values
<!--
Visit the following URL to see the rendered HTML:
https://bl.ocks.org/gurjeet/83189e2931d053187eab52887a870c5e
-->
<!DOCTYPE html>
<html>
<head>
<title>Barchart Demo</title>
@gurjeet
gurjeet / keybase.md
Created September 11, 2019 17:58
keybase.md

Keybase proof

I hereby claim:

  • I am gurjeet on github.
  • I am gurjeetsingh (https://keybase.io/gurjeetsingh) on keybase.
  • I have a public key ASDc68G3ePw0YBtaenpCM49R5kMCqTOBvIUwGiDlxl-xoAo

To claim this, I am signing this object: