Skip to content

Instantly share code, notes, and snippets.

@azend
azend / rocket.scad
Created August 13, 2012 02:36
Simple Parametric Rocket (made with OpenSCAD)
module rocket () {
$fn = 100;
rocket_diameter = 5;
rocket_length = 50;
rocket_nose_cone_length = 10;
rocket_num_fins = 3;
rocket_fin_length = 10;
@azend
azend / gist:4243348
Created December 9, 2012 04:42
Codeshield Example - Use the Force
/* Use the Force
Checks whether or not the user has the force by getting the light
value from photoresistor on the Codeshield and turns on the relay
if the user does in fact have the force. This code expects that
the relay is hooked into some other device to make a more resounding
force effect (such as a floor lamp).
The circuit:
* Photoresistor plugged into pin 5 (or soldered onto the Codeshield).
@azend
azend / gist:4665035
Last active December 11, 2015 21:48
Simple fade up using different colors on an rgb led. Works by overflowing the unsigned char until it rolls over.
/* Diyode CodeShield Pinout Constants */
#define ENCODER_A 14
#define ENCODER_B 15
#define ENCODER_PORT PINC
#define SWITCH 13
#define BUTTON 12
#define RGB_RED 11
#define RGB_GREEN 10
#define RGB_BLUE 9
#define LED 6
@azend
azend / HeaterBox.py
Last active December 14, 2015 01:59
Simple python script to warm up a cold room
#!/usr/bin/env python
import argparse
import threading
class Worker(threading.Thread):
def run (self):
while True:
pass;
/**
* azend's theory on medical naming schemes
*/
function nameMedicalCondition ( mainSymptom, severity ) {
var name = mainSymptom;
if ( is_int(severity) && severity > 5 + ( Math.floor( Math.rand() * 4 ) - 2 ) ) {
name += 'icul';
}
@azend
azend / gist:6063249
Created July 23, 2013 15:23
jQuery Mobile GA link tracking
$('a').on('click', function (e) {
// jQuery Mobile uses anchor tags for slider handles...
//
// Using the following is less eloquent than using :not()
// but it is browser compliant.
if ( !$(this).hasClass('ui-slider-handle') ) {
var external = this.target === '_blank' || this.rel === 'external';
<!-- A fairly normal copyright stamp with placeholder for current year -->
<p>&copy; Copywright <span class="copyrightYear"></span>, All rights reserved.</p>
<!-- Copywright date injection -->
<script type="text/javascript">
(function() {
function injectCopywrightDate() {
var year = new Date().getFullYear();
var placeholders = document.getElementsByClassName('copyrightYear');
@azend
azend / youloop
Last active August 29, 2015 14:27 — forked from parkerlreed/Makefile
Script to monitor clipboard for a new Youtube URL and plays the video when the URL does not match the existing URL. Also does not run when an mpv instance is already running.
#!/bin/bash
function loop(){
sleep 2
url=`xclip -selection clipboard -o`
if [[ `cat /tmp/youtubeurl` == "$url" ]]
then
return
fi
mpv=`pgrep mpv`
if [[ $url == *"youtube"* && $mpv == "" ]]
diff --git a/youloop b/youloop
index 3cb99e7..b94f06f 100644
--- a/youloop
+++ b/youloop
@@ -9,9 +9,9 @@ function loop(){
mpv=`pgrep mpv`
if [[ $url == *"youtube"* && $mpv == "" ]]
then
+ echo "$url" > /tmp/youtubeurl
mpv --hwdec vaapi --ytdl-format=bestvideo[ext=mp4]+bestaudio[ext=m4a] "$url"
Upstart -> service <service> start
Systemd -> systemctl start <service>
SysV init -> /etc/init.d/<service> start