Skip to content

Instantly share code, notes, and snippets.

Coding hard

Alex Berber junoteam

Coding hard
View GitHub Profile
petitviolet / nginx_deployment.yaml
Created Mar 11, 2018
sample Nginx configuration on Kubernetes using ConfigMap to configure nginx.
View nginx_deployment.yaml
apiVersion: v1
kind: ConfigMap
name: nginx-conf
nginx.conf: |
user nginx;
worker_processes 3;
error_log /var/log/nginx/error.log;
events {
voluntas / sysctl.conf
Created Oct 14, 2017 — forked from techgaun/sysctl.conf
Sysctl configuration for high performance
View sysctl.conf
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
edsiper /
Last active Nov 16, 2021
Kubernetes Useful Commands
jgamblin /
Created Apr 19, 2017
A Script To Set Current Spotify Song As Slack Status
APIKEY="From Here"
SONG=$(osascript -e 'tell application "Spotify" to name of current track as string')
URLSONG=$(echo "$SONG" | perl -MURI::Escape -ne 'chomp;print uri_escape($_),"\n"')
while true
curl -s -d "payload=$json" ""$APIKEY"&profile=%7B%22status_text%22%3A%22"$URLSONG"%22%2C%22status_emoji%22%3A%22%3Amusical_note%3A%22%7D" > /dev/null
sleep 60
fntlnz /
Last active Dec 4, 2021
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
tomazzaman /
Last active Nov 19, 2021
Kill supervisor on Docker when any of the services fail

Killing supervisor if any of it's child processes fail

The trick is to only register the listener for events that indicate failure, namely


Once they do, we should send a SIGQUIT to Supervisor.

lunny / diskinfo.go
Created Mar 28, 2014
Disk Info for Golang
View diskinfo.go
package main
import (
type DiskStatus struct {
All uint64 `json:"all"`
Used uint64 `json:"used"`
View ansible-lineinfile-examples.yml
## credit:
- hosts: alpine_install
user: root
# - name: create a complete empty file
# command: /usr/bin/touch /test/test.conf
- name: create a new file with lineinfile
willurd /
Last active Dec 4, 2021
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
rantav /
Created Aug 23, 2012
Find slow queries in mongo DB

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...