Skip to content

Instantly share code, notes, and snippets.

@rbq
rbq / docker.yaml
Last active November 15, 2024 03:30
Install Docker CE on Ubuntu using Ansible
---
- hosts: all
tasks:
- name: Install prerequisites for Docker repository
apt:
name: ['apt-transport-https', 'ca-certificates', 'curl', 'gnupg2', 'software-properties-common']
update_cache: yes
- name: Add Docker GPG key
apt_key:
@roylee0704
roylee0704 / dockergrep.sh
Created December 9, 2016 08:24
how to grep docker log
docker logs nginx 2>&1 | grep "127."
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container
@acherunilam
acherunilam / influxdb.conf
Created May 3, 2016 12:23
Nginx config for InfluxDB HA
http {
client_max_body_size 20M;
upstream influxdb {
server server1:8086;
server server2:8086;
}
upstream relay {
server server1:9096;
server server2:9096;
@darconeous
darconeous / dh.pem
Last active June 23, 2023 11:09
Getting FreeRadius set up on EdgeRouter
-----BEGIN DH PARAMETERS-----
MIIBCAKCAQEAq5/y4YW0hozeF0bQw86uDaDO0o+68DjAch61bc3nwyVC77e6JYUT
5F9x+mn9j25KhbcNGBcZvO/TFHsPf4bx4fojNKD2T5nZATJRtGuepnyjz5XEpPe2
ojAsjYpPg/0HZou/tyPM1OGTi5qlVUHa+GHrpX5419NDdOCU5IRr1kkIOMaT7+co
OFAlGCr8fiLTArGWbZDed3N0EvXE1JaIlOmQmVxLP8EycZsbjnCWB9b7DfQW2TeB
9Qp3PjfpAH/VPc3xrMqrXLlGR3h6PA5FfanN2e1XWISOYQe9N/K5uN6lze+HoAk6
Kusp+bLFxWX5EDxK1XXW+4L5JwNwUDMZCwIBAg==
-----END DH PARAMETERS-----
@masahirosuzuka
masahirosuzuka / .gitignore
Last active March 10, 2019 14:46
gitignore template for KiCad project
# temp files
*.bak
*.bck
*.kicad_pcb-bak
*-cache.lib
# *-rescue.lib
ftp-lib-table
# for external tools
*.dsn
@max-mapper
max-mapper / readme.md
Last active May 21, 2022 11:02
ffmpeg youtube live event rtmp stream from raspberry pi with raspi camera (raspivid)
  1. compile ffmpeg for arm https://github.com/fiorix/ffmpeg-arm
  2. create youtube 'live event'. get rtmp url + session id
  3. run this:
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/<SESSION>

you can tweak -b and -fps to your liking. the settings above work well for 1080p. by not specifying width or height we get the full 1920x1080 resolution from the raspi camera

@ah-cog
ah-cog / Using the Terminal to Upload an Arduino Sketch to the Teensy 3.1.md
Last active April 16, 2020 01:00
Upload to the Teensy 3.1 from Terminal on OS X with Arduino 1.6.1 and Teensyduino 1.21.

Uploading Arduino Sketches to the Teensy 3.1 from the Terminal

First, install Arduino 1.6.1 from http://arduino.cc/en/Main/Software. I followed the Mac OS X for Java 6 link to download arduino-1.6.1-macosx.zip. Install Arduino by unzipping the Arduino file and moving it to /Applications/Arduino. Open Arduino to make sure it works and so it can finish setting up the environment for use. Next, install Teensyduino 1.21 from https://www.pjrc.com/teensy/td_download.html. I followed Macintosh OS-X Installer to download teensyduino.dmg. Open and proceed through the Teensyduino installer, and when prompted to locate Arduino, select /Applications/Arduino, then continue to the next step in the installer.

At this point, you should be ready to upload a sketch. Follow the instructions below.

To upload from the terminal, enter the following command:

/Applications/Arduino.app/Contents/MacOS/JavaApplicationStub --board teensy:avr:teensy31 --port /dev/tty.usbmodem573061 --upload /Users/mokogobo/Checkout
@sergiotapia
sergiotapia / md5-example.go
Last active December 5, 2023 03:53
Golang - How to hash a string using MD5.
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
@mplewis
mplewis / flask-uwsgi-nginx-primer.md
Last active September 23, 2024 11:09
Flask + uWSGI + nginx Primer. I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

Flask + uWSGI + nginx Primer

I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

How this shit works

  • Flask is managed by uWSGI.
  • uWSGI talks to nginx.
@hernantz
hernantz / common_fabfile.py
Last active July 14, 2017 06:00
Fabfile with common fabric tasks, featuring virtualenvwrapper, nginx, supervisord, git deployment and some other goodies.
from fabric.api import task, local, sudo, run, prefix, env, cd
from fabric.contrib.files import exists, first
from contextlib import contextmanager, nested
def once(s):
"""Command_prefixes is a list of prefixes"""
if s not in env.command_prefixes:
return s
return 'true'