Skip to content

Instantly share code, notes, and snippets.

View allfake's full-sized avatar

nut allfake

  • opendream
View GitHub Profile
#include <VirtualWire.h>
int pirPin = 3; //the digital pin connected to the PIR sensor's output
char buffer[16];
void setup() {
Serial.begin(9600); // Debugging only
// Initialise the IO and ISR
vw_set_tx_pin(13);
@allfake
allfake / gist:6932459
Created October 11, 2013 10:11
Setup to use angular with grunt node ruby (not support oh my zsh and others)
install xcode from appstore for easy install command line
install command line at xcode
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
sudo mkdir /usr/local/Cellar
sudo chown -R `whoami` /usr/local
echo 'export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"' >> ~/.bash_profile
brew doctor --verbose
\curl -L https://get.rvm.io | bash -s stable --ruby
@allfake
allfake / gist:7210293
Last active December 26, 2015 20:39
co with and data by rf433
#include <VirtualWire.h> // ver. 1.5
#include <pt.h>
//global variable
#define MSG_SIZE 14
// end global variable
static struct pt pt1, pt2; // each protothread needs one of these
char buffer[MSG_SIZE];
float maxv, CO, CO_raw;
int circ = 5, heat = 6, send_round = 0;
// Control an 8x8 LED display with 2 x 74HC595 shift registers
// Using only 3 pins from the Arduino
// shift register = 8 pin
#define DEVICES 6
#define SHIFT_REGISTER 8
#define ALLFPIN SHIFT_REGISTER * DEVICES
// while condition variable
int whileVar = 0;
#!/usr/bin/python
# read more command
# http://www.elechouse.com/elechouse/images/product/13.56MHZ_RFID_Module/13.56MHZ_RFID_Manual.pdf
import serial
ser = serial.Serial(
port='/dev/tty.SLAB_USBtoUART',
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
@allfake
allfake / ddd
Created November 20, 2013 17:46
// Control an 8x8 LED display with 2 x 74HC595 shift registers
// Using only 3 pins from the Arduino
// shift register = 8 pin
#define DEVICES 6
#define SHIFT_REGISTER 8
#define ALLFPIN SHIFT_REGISTER * DEVICES
// while condition variable
int whileVar = 0;
@allfake
allfake / gist:8297899
Last active January 2, 2016 11:39
load cell
int minVal = -999;
int threshold = 20;
int calibrate = 300;
int val = 0;
void setup()
{
Serial.begin(9600);
}
/*
Simple example for receiving
http://code.google.com/p/rc-switch/
Need help? http://forum.ardumote.com
*/
#include <RCSwitch.h>
@allfake
allfake / Ready to use fixed rotated image
Last active August 29, 2015 14:14
Ready to use fixed rotated image
ALAssetRepresentation *assetRepresentation = [asset defaultRepresentation];
CGImageRef fullResImage = [assetRepresentation fullResolutionImage];
NSString *adjustment = [[assetRepresentation metadata] objectForKey:@"AdjustmentXMP"];
if (adjustment) {
NSData *xmpData = [adjustment dataUsingEncoding:NSUTF8StringEncoding];
CIImage *image = [CIImage imageWithCGImage:fullResImage];
NSError *error = nil;
NSArray *filterArray = [CIFilter filterArrayFromSerializedXMP:xmpData
inputImageExtent:image.extent
@allfake
allfake / showPolygon2Dcollider.cs
Last active December 30, 2023 19:02 — forked from adekbadek/showedgecollider.cs
Show 2D Polygon Collider as Gizmo, also in Edit Mode (Not support rotation)
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[ExecuteInEditMode]
public class VisibleCollider : MonoBehaviour {
public bool showLine = true;
public Color lineColor = Color.blue;