Skip to content

Instantly share code, notes, and snippets.

@imam-san
imam-san / postgres-cheatsheet.md
Created January 17, 2018 07:45 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@imam-san
imam-san / go-install.md
Created March 14, 2018 17:30 — forked from diegopacheco/go-install.md
How to Install GO Lang on CentOS / Amazon Linux?

How to Install GO Lang on CentOS / Amazon Linux?

sudo wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
tar -xzf go1.4.2.linux-amd64.tar.gz 
export GOROOT=PATH_WHERE_YOU_EXTRACT_GO
export PATH=$PATH:$GOROOT/bin 
export GOBIN=$GOROOT/bin 
mkdir ~/golang/ 
export GOPATH=~/golang/ 
@imam-san
imam-san / go-install.md
Created March 14, 2018 17:30 — forked from diegopacheco/go-install.md
How to Install GO Lang on CentOS / Amazon Linux?

How to Install GO Lang on CentOS / Amazon Linux?

sudo wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
tar -xzf go1.4.2.linux-amd64.tar.gz 
export GOROOT=PATH_WHERE_YOU_EXTRACT_GO
export PATH=$PATH:$GOROOT/bin 
export GOBIN=$GOROOT/bin 
mkdir ~/golang/ 
export GOPATH=~/golang/ 
@imam-san
imam-san / gist:f70444c2b25805bd04b40df946894f18
Created March 20, 2018 08:03 — forked from tobym/gist:3538214
My pwdx implementation for a mac
#!/bin/bash
lsof -a -p $1 -d cwd -n | tail -1 | awk '{print $NF}'
@imam-san
imam-san / BCD Converter.c
Created February 18, 2020 17:08
BCD Converter.c
int Hexascii(unsigned char *dest, unsigned char *src, int size)
{
int i;
if (size > 0)
{
for (i = 0; i < (size / 2); i++)
{
*(dest + (2 *i)) = ((*(src + i) &0xF0) >> 4) + 0x30;
@imam-san
imam-san / amt.dart
Created February 18, 2020 19:29
Flutter Hex To Ascii
import 'dart:convert';
int covertToAmt(var l){
var amt = 0;
for (int i = 0, j=l.length-1; i < l.length; i++, j--) {
amt+=((l[j]<<(i*8)));
}
return amt;
}