Skip to content

Instantly share code, notes, and snippets.

Avatar
😃
Coding hard

Alex Berber junoteam

😃
Coding hard
View GitHub Profile
@petitviolet
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
metadata:
name: nginx-conf
data:
nginx.conf: |
user nginx;
worker_processes 3;
error_log /var/log/nginx/error.log;
events {
@voluntas
voluntas / sysctl.conf
Created Oct 14, 2017 — forked from techgaun/sysctl.conf
Sysctl configuration for high performance
View sysctl.conf
### KERNEL TUNING ###
# 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
edsiper / kubernetes_commands.md
Last active Nov 16, 2021
Kubernetes Useful Commands
View kubernetes_commands.md
@jgamblin
jgamblin / slackspotify.sh
Created Apr 19, 2017
A Script To Set Current Spotify Song As Slack Status
View slackspotify.sh
#!/bin/bash
APIKEY="From Here https://api.slack.com/custom-integrations/legacy-tokens"
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
do
curl -s -d "payload=$json" "https://slack.com/api/users.profile.set?token="$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
done
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active Dec 4, 2021
Self Signed Certificate with Custom Root CA
View self-signed-certificate-with-custom-ca.md

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
tomazzaman / README.md
Last active Nov 19, 2021
Kill supervisor on Docker when any of the services fail
View README.md

Killing supervisor if any of it's child processes fail

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

  • PROCESS_STATE_STOPPED
  • PROCESS_STATE_EXITED
  • PROCESS_STATE_FATAL

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

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

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
rantav / README.md
Created Aug 23, 2012
Find slow queries in mongo DB
View README.md

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...