Skip to content

Instantly share code, notes, and snippets.

@ledlogic
ledlogic / har2csv.rb
Created February 27, 2016 00:47
Extract urls from har file to csv (text) file.
#!/usr/bin/ruby
require 'rubygems'
require 'json'
require 'csv'
infile = ARGV[0]
json = File.read(infile)
parsed = JSON.parse(json.encode("UTF-8"))
outfile = ARGV[1]
@ledlogic
ledlogic / stargate.pde
Created September 21, 2022 01:29
An animation for use behind a circular stargate
double dim = 600;
double center = dim/2;
double offsetX = 0;
double offsetY = 0;
double range = 10;
double scale = dim / range;
double plotWidth = 0.05;
double plotIncrement = 0.1;
double sinhFactor = 1.25; // 1.25
@ledlogic
ledlogic / techno_obelisk.ino
Last active August 15, 2022 06:35
A rendering for an eerie obelisk.
#include <Adafruit_NeoPixel.h>
#define PIN 1
//single pixel, v2 Flora RGB NeoPixel, so GRB bitsream at 800 khz
Adafruit_NeoPixel strip = Adafruit_NeoPixel(4, PIN, NEO_GRB + NEO_KHZ800);
// assuming we have adafruit gemma v2
// http://adafru.it/1222
// assuming we have four fiora RGB neopixels
@ledlogic
ledlogic / EEPROMExample.ino
Created January 24, 2015 16:28
Example for Arduino EEPROM read / writes
/////////////////////////////////////////////////////////////////
// Created by Kevin Elsenberger //
// June 2, 2013 //
// elsenberger.k at gmail.com //
// from http://playground.arduino.cc/Code/EEPROMReadWriteLong //
/////////////////////////////////////////////////////////////////
//Needed to access the eeprom read write functions
#include <EEPROM.h>
@ledlogic
ledlogic / Klingon-D7.ino
Last active September 14, 2020 03:37
Arduino script for lighting of a Klingon D7 model
/*
Klingon-D7
1) Light up impulse lights (pin 11)
2) Detect button press (pin 2)
3) Fire torpedo (pin 9)
*/
int PIN_TORPEDO_BUTTON = 2;
int PIN_TORPEDO = 9;
int PIN_IMPULSE = 11;
@ledlogic
ledlogic / Gps3.ino
Created July 31, 2014 13:11
GPS code for current position
/*
This program demonstrates the dGPS library from Dexter Industries for Arduino
For use with the Dexter Industries GPS Shield. The dGPS can be found here:
- http://dexterindustries.com/Arduino-GPS_Shield.html
This code was originally based on the work of others. You can see the original work here:
- SoftwareSerial Library: http://www.arduino.cc/en/Reference/SoftwareSerial
- GPS Tutorial: http://www.arduino.cc/playground/Tutorials/GPS
@ledlogic
ledlogic / gist:8532028
Last active January 3, 2016 22:59
System.currentTimeMillis versus (new Date()).getTime()
package ledlogic.com.utility;
import java.util.Date;
import org.apache.log4j.Logger;
import org.junit.Test;
public class MsTest {
private static final Logger LOG = Logger.getLogger(MsTest.class);
@ledlogic
ledlogic / boostrap-youtube-modal.js
Last active December 29, 2015 03:29 — forked from jawinn/boostrap-youtube-modal.js
* Modifies youtube anchor urls * Uses purl plugin instead of queryparser plugin. * Uses require * Self-contained html
/**
* Modifies youtube anchor urls
* Uses purl plugin instead of queryparser plugin.
* Uses require
* If too small, punts and goes to original url (use target to pop).
*
* @see http://www.joshuawinn.com/opening-youtube-links-dynamically-in-a-twitter-bootstrap-modal-window/
*/
define(['require',
@ledlogic
ledlogic / GpsLogger.ino
Last active December 7, 2015 19:42
A logger for GPS
#include "SoftwareSerial.h"
#include "dGPS.h"
#include "SPI.h"
#include "SD.h"
#include "stdlib.h"
// SD card
const int CS_pin = 10;
dGPS dgps = dGPS(); // Construct dGPS class
@ledlogic
ledlogic / singleStat.rb
Created January 25, 2015 19:07
Ruby program to load single column CSV file and compute descriptive statistics.
require 'csv'
require 'descriptive_statistics'
#data array to store values
data = []
# load data
CSV.foreach('20150124.csv') do |row|
data << row[0]
end