Skip to content

Instantly share code, notes, and snippets.

View projectweekend's full-sized avatar

Brian Hines projectweekend

View GitHub Profile
@projectweekend
projectweekend / update_atom
Last active August 26, 2017 15:14
Script to update Atom text editor on Ubuntu
#!/usr/bin/env bash
ATOM_DOWNLOAD_URL='https://atom.io/download/deb'
ATOM_DOWNLOAD_DIR="$HOME/Downloads"
ATOM_DEB_FILE="$ATOM_DOWNLOAD_DIR/atom.deb"
wget $ATOM_DOWNLOAD_URL --output-document=$ATOM_DEB_FILE && \
sudo dpkg --install $ATOM_DEB_FILE && \
rm $ATOM_DEB_FILE
@projectweekend
projectweekend / lambda_boto3_example.py
Last active February 8, 2022 13:03
Update AWS Lambda code with Boto3
import io
import os
from zipfile import ZipFile
from boto3.session import Session
session = Session(
aws_access_key_id='your-aws-access-key',
aws_secret_access_key='your-iam-secret-key',
region_name='your-aws-region')
@projectweekend
projectweekend / fabfile.py
Last active February 9, 2016 02:57
A simple fabfile.py example
from fabric.api import env, sudo
env.use_ssh_config = True
env.hosts = ['raspberry_pi']
def update_upgrade():
sudo('apt-get update')
sudo('apt-get upgrade -y')
@projectweekend
projectweekend / __init__.py
Created February 8, 2016 20:46
Helper function (build_xml) used to generate Alfred items XML
from .alfred_script_filter_xml import build_xml
@projectweekend
projectweekend / config
Created January 26, 2016 01:52
Example SSH config file block
Host raspberry_pi
Hostname 10.0.1.31
User pi
Forwardx11 yes
ServerAliveInterval 300
void writeJSONToSerial(void)
{
String jsonString = "{\"temp_f\":";
jsonString += sensordata.tempF;
jsonString += ",\"temp_c\":";
jsonString += sensordata.tempC;
jsonString += "}";
Serial.println(jsonString);
}
import json
import serial
# this port address is for the serial tx/rx pins on the GPIO header
SERIAL_PORT = '/dev/ttyAMA0'
# be sure to set this to the same rate used on the Arduino
SERIAL_RATE = 9600
@projectweekend
projectweekend / read_serial.py
Last active October 4, 2023 02:22
Reading from a serial port in Python
import serial
# this port address is for the serial tx/rx pins on the GPIO header
SERIAL_PORT = '/dev/ttyAMA0'
# be sure to set this to the same rate used on the Arduino
SERIAL_RATE = 9600
def main():
@projectweekend
projectweekend / raspbian_jessie_upgrade.sh
Created October 31, 2015 16:10
Upgrade Raspberry Pi to Raspbian Jessie
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
@projectweekend
projectweekend / example.py
Created April 25, 2015 05:31
Example Python script
import requests
response = requests.get('https://api.github.com/users/projectweekend')
data = response.json()
message = "{0} has {1} followers and {2} public repos."
print(message.format(data['login'], data['followers'], data['public_repos']))