This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#include <bitset> | |
#include <iostream> | |
std::string hex_to_binary(std::string hexstring){ | |
static char base16encoding_table[] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; | |
std::string binstring; | |
for( int i = 0; i < hexstring.length(); i++){ | |
binstring += std::bitset<4>((int)(strchr(base16encoding_table,hexstring[i]) - base16encoding_table)).to_string(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <RCSwitch.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
RCSwitch mySwitch = RCSwitch(); | |
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin(9600); | |
Serial.println("Setup"); | |
pinMode(4, OUTPUT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple script to start/stop Amazon EC2 instances | |
import boto3 | |
import sys | |
region = 'us-east-1' | |
instances = ['X-XXXXXXXX'] | |
aws_id = "XXXXXXXXXXXXXXXXXXXX" | |
aws_secret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
def start_instance(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#simple script to upload image to s3 with a generic name | |
import boto3 | |
import uuid | |
def uploadImage( img_name ): | |
file_name = str(uuid.uuid4())+'.png' | |
url = 'https://<bucket-name>.s3.amazonaws.com/'+file_name | |
s3 = boto3.client( | |
's3', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//basic usage bcrypt hashing | |
var bcrypt = require('bcrypt'); | |
function createHash(password){ | |
bcrypt.genSalt(10, function(err, salt) { | |
bcrypt.hash(password, salt, function (err, hash) { | |
if (err) { | |
console.log(err); | |
return err; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// bing static map generator | |
var http = require('http'); | |
var fs = require('fs'); | |
var Jimp = require('jimp'); | |
var uuid = require('uuid'); | |
var url = require('url'); | |
http.createServer(function(req, res){ | |
console.log(req.url); |