Skip to content

Instantly share code, notes, and snippets.

Tsyren Funfun

Block or report user

Report or block Funfun

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Funfun
Funfun / README.md
Created Nov 12, 2018
504 Gateway Demo
View README.md
curl -iH "Host: delaymaster.local" http://127.0.0.1\?delay\=70s

returns

HTTP/1.1 504 Gateway Time-out
Server: nginx/1.14.1
Date: Mon, 12 Nov 2018 21:03:37 GMT
View user_settings.json
{
"editor.wordWrap": "bounded",
"editor.wordWrapColumn": 160,
"editor.fontSize": 14,
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": false,
"editor.smoothScrolling": true,
"editor.minimap.enabled": false,
"editor.rulers": [
80,
@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 / changes.md
Last active Oct 15, 2018
overview of changes
View changes.md
@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 gorm_logger.go
func (logger Logger) Print(values ...interface{}) {
if len(values) > 1 {
level := values[0]
currentTime := "\n\033[33m[" + NowFunc().Format("2006-01-02 15:04:05") + "]\033[0m"
source := fmt.Sprintf("\033[35m(%v)\033[0m", values[1])
messages := []interface{}{source, currentTime}
if level == "sql" {
// duration
messages = append(messages, fmt.Sprintf(" \033[36;1m[%.2fms]\033[0m ", float64(values[2].(time.Duration).Nanoseconds()/1e4)/100.0))
You can’t perform that action at this time.