Skip to content

Instantly share code, notes, and snippets.

@shmick
shmick / bash.generate.random.alphanumeric.string.sh
Created November 10, 2015 14:49 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@shmick
shmick / usbreset.c
Created January 6, 2016 04:23 — forked from x2q/usbreset.c
/* usbreset -- send a USB port reset to a USB device
*
* Compile using: gcc -o usbreset usbreset.c
*
*
* */
@shmick
shmick / README.md
Created January 7, 2016 01:31 — forked from renchap/README.md
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {
@shmick
shmick / build_nginx.sh
Last active January 30, 2016 20:00 — forked from MattWilcox/build_nginx.sh
Fetch, build, and install the latest nginx with the latest OpenSSL for RaspberryPi
#!/usr/bin/env bash
# names of latest versions of each package
export VERSION_PCRE=pcre-8.38
export VERSION_OPENSSL=openssl-1.0.2f
export VERSION_NGINX=nginx-1.9.9
# URLs to the source directories
export SOURCE_PCRE=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
export SOURCE_OPENSSL=https://www.openssl.org/source/
#!/bin/bash
if [[ $EUID -ne 0 ]]
then
echo "This script must be run as root"
exit 1
fi
OUTPUT=$(/usr/local/etc/letsencrypt.sh/letsencrypt.sh -c)
echo "$OUTPUT" | grep Renewing
@shmick
shmick / build_nginx.sh
Created February 17, 2016 20:36 — forked from MatthewVance/build_nginx.sh
Fetch, build, and install the latest nginx with the latest OpenSSL for RaspberryPi
#!/usr/bin/env bash
# make script exit if a simple command fails and
# make script print commands being executed
set -e -x
# names of latest versions of each package
export VERSION_PCRE=pcre-8.38
export VERSION_OPENSSL=openssl-1.0.2f
export VERSION_NGINX=nginx-1.9.11
@shmick
shmick / 20160225_compile_log_1
Created February 25, 2016 18:19
Compiling LinkMeter using OpenWrt 12.09 branch f83d737 ( r36423 )
$ vagrant up ; vagrant ssh
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Setting the name of the VM: trusty64_default_1456413993437_55351
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
# I've only tested this on Ubuntu 14.04 64bit using ubuntu/trusty64 via Vagrant
#
# This one liner will install all required build tools and begin the compile process
# bash <(curl -s0 https://gist.githubusercontent.com/shmick/f16d1f9331404ad61993/raw)
#
echo "Running apt-get update..." && \
sudo apt-get -qq update && \
echo "Running apt-get install..." && \
sudo apt-get -qq install \
git-core \

Keybase proof

I hereby claim:

  • I am shmick on github.
  • I am shmick (https://keybase.io/shmick) on keybase.
  • I have a public key whose fingerprint is 8302 5F5B F47A 0C57 B20F 21B2 1E32 9473 C076 DAEB

To claim this, I am signing this object:

@shmick
shmick / TwinkleFOX.ino
Created November 20, 2016 16:17 — forked from kriegsman/TwinkleFOX.ino
TwinkleFOX: Colored Twinkling Holiday Lights
#include "FastLED.h"
#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
#warning "Requires FastLED 3.1 or later; check github for latest code."
#endif
#define NUM_LEDS 100
#define LED_TYPE WS2811
#define COLOR_ORDER GRB