Skip to content

Instantly share code, notes, and snippets.

@Funfun
Funfun / curl_post_json.md
Created Oct 31, 2018 — forked from ungoldman/curl_post_json.md
post a file JSON file with curl
View curl_post_json.md

How do POST file with curl??

You can post a json file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example:

View postgres cheatsheet.md

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@Funfun
Funfun / install_postgresql.sh
Created Oct 31, 2018 — forked from dstroot/install_postgresql.sh
Install PostgreSQL on Amazon AMI
View install_postgresql.sh
#!/bin/bash
###############################################
# To use:
# https://raw.github.com/gist/2776351/???
# chmod 777 install_postgresql.sh
# ./install_postgresql.sh
###############################################
echo "*****************************************"
echo " Installing PostgreSQL"
echo "*****************************************"
@Funfun
Funfun / README.md
Created Oct 19, 2018 — forked from alexellis/README.md
Provision a Raspberry Pi SD card
View README.md

You'll need

  • Raspberry Pi 3, 3+ or 2 (only)
  • A Linux PC, laptop or Raspberry with SD card reader/slot
  • A number of Raspberry Pis configured with Ethernet

You must have an SSH key, if you don't know what this is then type in ssh-keygen and follow the instructions.

Provision each Raspberry Pi:

@Funfun
Funfun / go_cpu_memory_profiling_benchmarks.sh
Created Sep 6, 2018 — forked from arsham/go_cpu_memory_profiling_benchmarks.sh
Go cpu and memory profiling benchmarks. #golang #benchmark
View go_cpu_memory_profiling_benchmarks.sh
FILENAME=$(basename $(pwd))
go test -run=. -bench=. -cpuprofile=cpu.out -benchmem -memprofile=mem.out -trace trace.out
go tool pprof -pdf $FILENAME.test cpu.out > cpu.pdf && open cpu.pdf
go tool pprof -pdf --alloc_space $FILENAME.test mem.out > alloc_space.pdf && open alloc_space.pdf
go tool pprof -pdf --alloc_objects $FILENAME.test mem.out > alloc_objects.pdf && open alloc_objects.pdf
go tool pprof -pdf --inuse_space $FILENAME.test mem.out > inuse_space.pdf && open inuse_space.pdf
go tool pprof -pdf --inuse_objects $FILENAME.test mem.out > inuse_objects.pdf && open inuse_objects.pdf
go tool trace trace.out
go-torch $FILENAME.test cpu.out -f ${FILENAME}_cpu.svg && open ${FILENAME}_cpu.svg
@Funfun
Funfun / bash-cheatsheet.sh
Created Mar 10, 2017 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
View bash-cheatsheet.sh
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
View git_config
git config --global color.ui auto
git config --global core.editor vim
git config --global alias.st status
git config --global alias.br branch
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.l 'log --color --graph --pretty=oneline --decorate --date=short --abbrev-commit --branches'
git config --global alias.ds 'diff --stat'
@Funfun
Funfun / tls-client.go
Created Jan 30, 2017 — forked from michaljemala/tls-client.go
SSL Client Authentication Golang sample
View tls-client.go
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@Funfun
Funfun / remove_brew-mongo_osx.sh
Created Dec 22, 2015 — forked from katychuang/remove_brew-mongo_osx.sh
remove mongodb that was installed via brew
View remove_brew-mongo_osx.sh
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep mongo
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
launchctl remove homebrew.mxcl.mongodb
pkill -f mongod