Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Meub meub

View GitHub Profile
View WiFiButton.ino
/*
This Arduino sketch sends a GET request to the specified
domain and appends a unique DEVICE_ID as a query parameter
on the request. After sending the device will go into Deep
Sleep mode to conserve power.
*/
#include <ESP8266WiFi.h>
#ifndef STASSID
@meub
meub / pi-servo-slack.py
Created Mar 6, 2020
Pi Servo Slack Script
View pi-servo-slack.py
#!/usr/bin/env python
# Raspberry PI Bell Ringer
import re
import time
import json
import os
import slack
import RPi.GPIO as GPIO # Importing the GPIO library
@meub
meub / check-pi-servo.sh
Created Mar 4, 2020
Bash script to check if Pi servo process is running
View check-pi-servo.sh
#!/bin/bash
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
if ps -aux | grep -v grep | grep "pi-servo.py" >/dev/null
then
echo "Process is running."
else
echo "Process is not running. Starting it up..."
python3 /home/pi/pi-servo.py
@meub
meub / pi-servo.py
Last active Aug 15, 2020
Raspberry Pi Bell Ringer
View pi-servo.py
#!/usr/bin/env python
import time
import RPi.GPIO as GPIO # Importing the GPIO library
from time import sleep # Import sleep module from time library
# Set up GPIO
servo_pin = 21 # GPIO Pin where servo is connected
GPIO.setmode(GPIO.BCM)
@meub
meub / pi-monte-carlo.py
Created Mar 14, 2019 — forked from louismullie/pi-monte-carlo.py
Monte Carlo Estimation of PI in Python
View pi-monte-carlo.py
import random as r
import math as m
# Number of darts that land inside.
inside = 0
# Total number of darts to throw.
total = 1000
# Iterate for the number of darts.
for i in range(0, total):
@meub
meub / gist:5e6efce206ceb86f7075411c452530a0
Last active Apr 27, 2018
Instructions on how to setup DD-WRT to recognize Amazon Dash button presses
View gist:5e6efce206ceb86f7075411c452530a0
### Dash Button Hack ###
DD WRT > Services > Services > Additional DNSMasq options:
dhcp-script=/tmp/custom.sh
DD WRT > Status > Wireless:
Press your Dash button.
Note your MAC address as it appears on the Status page.
DD WRT > Administration > Commands > Custom Script:
@meub
meub / gist:cc4fe3e0d4269efb8569c7ce70a2addd
Last active Jun 29, 2020
Scrape ReserveAmerica for Available Campsites
View gist:cc4fe3e0d4269efb8569c7ce70a2addd
import os, sys, re, io, json, time
import mechanize
import pytz
import smtplib
import bs4
from datetime import datetime, timedelta
from pytz import timezone
from bs4 import BeautifulSoup
from email.mime.text import MIMEText
@meub
meub / gist:6314276
Created Aug 23, 2013
CSS Transform, with Transform Origin
View gist:6314276
.rotate {
-webkit-transform: rotate(90deg);
-webkit-transform-origin: left top;
-moz-transform: rotate(90deg);
-moz-transform-origin: left top;
-ms-transform: rotate(90deg);
-ms-transform-origin: left top;
-o-transform: rotate(90deg);
-o-transform-origin: left top;
@meub
meub / gist:6201298
Created Aug 10, 2013
Absolute Centering
View gist:6201298
/* Must have a declared height */
.Absolute-Center {
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}
@meub
meub / gist:6091400
Created Jul 26, 2013
Prevent parseJSON from barfing on line breaks.
View gist:6091400
function parse(text) {
text = str_replace("\r\n", "\n", text);
text = str_replace("\r", "\n", text);
text = str_replace("\n", "\\n", text);
return text;
}
You can’t perform that action at this time.