Skip to content

Instantly share code, notes, and snippets.

View mralexgray's full-sized avatar

Alex Gray mralexgray

View GitHub Profile
@mralexgray
mralexgray / .gitignore
Created December 12, 2015 01:59 — forked from TooTallNate/.gitignore
low-level objc runtime apis
*
!*.m
!Makefile
@mralexgray
mralexgray / ORSSerialPort+Attributes.m
Created December 1, 2015 21:42 — forked from armadsen/ORSSerialPort+Attributes.m
Example code to get USB device properties for a given instance of ORSSerialPort. Will only work for USB-to-serial adapters, not internal serial ports. Based on https://gist.github.com/rhwood/4124251.
#import <Foundation/Foundation.h>
#import <IOKit/usb/USBSpec.h>
#import "ORSSerialPort.h"
@interface ORSSerialPort (Attributes)
@property (nonatomic, readonly) NSDictionary *ioDeviceAttributes;
@property (nonatomic, readonly) NSNumber *vendorID;
@property (nonatomic, readonly) NSNumber *productID;
@mralexgray
mralexgray / index.js
Created October 14, 2015 04:02 — forked from iamnoah/index.js
Simple node.js webserver with logging. Serves whatever files are reachable from the directory where node is running.
/*
* Copyright (c) 2010 Noah Sloan <http://noahsloan.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
#include <ESP8266WiFi.h>
const char* ssid = "yourSsid";
const char* password = "yourPassword";
String readStrings = ""; // สร้างตัวแปรมาเก็บข้อมูลค่าที่ส่งเข้ามา
int pin1 = 14; //กำหนด GPIO 14 (D5)
int pin2 = 12; //กำหนด GPIO 12 (D6)
int pin3 = 13; //กำหนด GPIO 13 (D7)
@mralexgray
mralexgray / via-ssh.sh
Last active August 29, 2015 14:25 — forked from vitex/via-ssh.sh
#!/bin/sh
########################################################################
#
# Usage: via-ssh.sh [-v] [-d] [USER@]SERVER[:PORT]
#
# -v Provide verbose output.
# -d Send all UDP on the DNS port 53 to 127.0.0.1.
# USER User name to use for SSH; default is current user.
# SERVER Server to use for SSH.
(*
Many thanks to those unknowing contributers that share their Applescript on the web. A few that helped with this script include:
- Most of the UI Scripting came from Yoshimasa Niwa here: https://gist.github.com/4223249
- Code for checking if an app is running came from here: http://codesnippets.joyent.com/posts/show/1124
#### n8henrie Sat Mar 16 14:41:41 MDT 2013
* Added several delays that seemed to be responsible for breaking this script in iTunes 11
#### n8henrie Sun Mar 17 09:57:47 MDT 2013
* Added compatibility with iTunes 10 (untested, please confirm if you can)
@mralexgray
mralexgray / dynv6.sh
Last active August 29, 2015 14:22 — forked from corny/dynv6.sh
#!/bin/sh -e
hostname=$1
device=$2
file=$HOME/.dynv6.addr6
[ -e $file ] && old=`cat $file`
if [ -z "$hostname" -o -z "$token" ]; then
echo "Usage: token=<your-authentication-token> [netmask=64] $0 your-name.dynv6.net [device]"
exit 1
fi
@mralexgray
mralexgray / README.md
Last active August 29, 2015 14:19 — forked from atenni/README.md

Problem: When linking to the raw version of a gist, the link changes with each revision.

Solution:

To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/

To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]

@mralexgray
mralexgray / ansi_color_test.rb
Last active August 29, 2015 14:18 — forked from d11wtq/ansi_color_test.rb
Ansi Color Test
#!/usr/bin/ruby
class AnsiColorTest
FG = 38
BG = 48
class << self
def label(n, type)
"\033[01;#{type};5;#{n}m %3s \033[0m" % n
end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.