Skip to content

Instantly share code, notes, and snippets.

Avatar

Aarón Rosas a2ron

View GitHub Profile
@a2ron
a2ron / compile-nginx.sh
Last active Aug 7, 2017 — forked from tollmanz/compile-nginx.sh
Install NGINX (compiling and adding extra modules)
View compile-nginx.sh
################################################################################################
# VARS
SOURCES_FOLDER="/opt/"
################################################################################################
# move to folder where we will download the sources
cd $SOURCES_FOLDER
# dependency
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
tar -zxf pcre-8.40.tar.gz
@a2ron
a2ron / analytics.nginx
Last active Aug 7, 2017 — forked from jirutka/analytics.conf
Add Google Analytics tracking code to HTML via nginx
View analytics.nginx
# Add Google Analytics tracking code to HTML response
#
# Usage:
# set $tracking_id 'UA-********-*';
# include incl/analytics.conf;
#
# It needs nginx compiled with option --with-http_sub_module.
# Uses optimized GA code from: http://mathiasbynens.be/notes/async-analytics-snippet
#
@a2ron
a2ron / ImperialMarch.ino
Last active Jan 3, 2018 — forked from StevenNunez/ImperialMarch.ino
Imperial march played on an Arduino with a Piezo Element
View ImperialMarch.ino
int speakerPin = 5;
String notes[] = {"G4","G4", "G4", "D#4/Eb4", "A#4/Bb4", "G4", "D#4/Eb4","A#4/Bb4", "G4", "D5", "D5", "D5", "D#5/Eb5", "A#4/Bb4", "F#4/Gb4", "D#4/Eb4","A#4/Bb4", "G4", "G5","G4","G4","G5","F#5/Gb5", "F5","E5","D#5/Eb5","E5", "rest", "G4", "rest","C#5/Db5","C5","B4","A#4/Bb4","A4","A#4/Bb4", "rest", "D#4/Eb4", "rest", "F#4/Gb4", "D#4/Eb4","A#4/Bb4", "G4" ,"D#4/Eb4","A#4/Bb4", "G4"};
int beats[] = { 8, 8, 8, 6, 2, 8, 6 , 2 ,16 , 8, 8, 8, 6, 2, 8, 6, 2, 16,8,6,2,8,6,2,2, 2, 2,6,2,2,8,6,2,2,2,2,6,2,2,9,6,2,8,6,2,16 };
int tempo = 50;
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
@a2ron
a2ron / cec-keypresses.sh
Created Oct 21, 2018 — forked from bahamas10/cec-keypresses.sh
use `cec-client` to fire events when keys are pressed
View cec-keypresses.sh
#!/usr/bin/env bash
#
# binding remote control commands
#
# Author: Aaron Rosas
# Date: 21/10/2018
# Licens: MIT
# Tested on: Raspberry pi 3 with cec-client installed
cec-client -t a | perl -nle 'BEGIN{$|=1} /key (pressed|released): (.*) (.*) (.*)/ && print $2' | \
@a2ron
a2ron / .bashrc
Last active Jan 15, 2020
Load NVM on demand
View .bashrc
export NVM_DIR="$HOME/.nvm"
# Default node version
alias node="$HOME/.nvm/versions/node/v8.11.1/bin/node"
# Function to load the original nvm and execute it
load_and_exec_nvm(){
unalias node
unalias nvm
echo "Loading NVM..."
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
You can’t perform that action at this time.