Skip to content

Instantly share code, notes, and snippets.

View brianpeiris's full-sized avatar

Brian Peiris brianpeiris

View GitHub Profile
@brianpeiris
brianpeiris / findrefs.sh
Created September 8, 2016 04:23 — forked from jaburns/findrefs.sh
Find scene and prefab references to scripts in Unity.
#!/usr/bin/env bash
#
# Run from the project root. Pass the full name of a script, or substring of the names of the scripts to check.
#
# Example
# $) ./findrefs.sh BackgroundCamera
# Finding matches for script Assets/Scripts/Camera/BackgroundCamera.cs.meta ...
# Assets/Prefabs/CaveBGCamera.prefab: m_Script: {fileID: 11500000, guid: 7e63acfee367c4314852b87218149bd3, type: 3}
# Assets/Prefabs/ForestBGCamera.prefab: m_Script: {fileID: 11500000, guid: 7e63acfee367c4314852b87218149bd3, type: 3}
#
@brianpeiris
brianpeiris / .gitignore
Last active September 30, 2021 13:07
An AutoHotKey script for positioning and resizing windows
WindowsHelpers-Run-As-Admin.lnk
@brianpeiris
brianpeiris / disktone.py
Last active December 8, 2016 12:35
A python program (for windows) that plays tones based on disk activity
import time
import psutil
import winsound
last_disk_time = None
last_time = None
while (True):
curr_time = time.time()
counters = psutil.disk_io_counters()
@brianpeiris
brianpeiris / ICSE_2015_JS.md
Last active August 8, 2016 14:44
ICSE 2015 JavaScript Research

TypeDevil: Dynamic Type Inconsistency Analysis for JavaScript

Dynamic languages, such as JavaScript, give programmers the freedom to ignore types, and enable them to write concise code in short time. Despite this freedom, many programs follow implicit type rules, for example, that a function has a particular signature or that a property has a particular type. Violations of such implicit type rules often correlate with problems in the program. This paper presents Type Devil, a mostly dynamic analysis that warns developers about inconsistent types. The key idea is to assign a set of observed types to each variable, property, and function, to merge types based in their structure, and to warn developers about variables, properties, and functions that have inconsistent types. To deal with the pervasiveness of polymorphic behavior in real-world JavaScript programs, we present a set of techniques to remove spurious warnings and to merge related warnings. Applying Type Devil to widely used benchmark suites and rea

@brianpeiris
brianpeiris / TerminalKeyboardShortcutCheatSheet.md
Last active August 29, 2015 14:14
Terminal Keyboard Shortcut Cheat Sheet

Terminal Keyboard Shortcut Cheat Sheet

Shortcut Action
Ctrl-a Move to start of line
Ctrl-e Move to end of line
Alt-b Move back one word
Alt-f Move forward one word
Ctrl-w Delete word before cursor
@brianpeiris
brianpeiris / BirdsAndBlossoms.js
Created October 26, 2014 16:16
RiftSketch - Birds and Blossoms
var seed = '1', rands;
Math.seedrandom(seed);
if (
window.seed && window.seed !== seed ||
!window.rands
) {
rands = window.rands = [];
for (var i = 0; i < 50000; i++) {
rands.push(Math.random());
}
// Converts double quotes to single quotes using a JavsScript language parser.
// Single quotes and escaped doubled quotes inside strings are converted to
// double quotes.
//
// Adapted from
// http://ariya.ofilabs.com/2012/02/from-double-quotes-to-single-quotes.html
//
// Usage:
// $ node singlequote.js <input> [output]
// If an output file is not given, the script modified the input file itself.
/*
Get acceleration data from Chronos watch.
Taken from info posted at: http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/32714.aspx
Based off of the latest Python code on the Chronos wiki that I wrote.
Copyright (c) 2010 Sean Brewer
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
<snippet>
<content><![CDATA[
import ipdb; ipdb.set_trace()
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- <tabTrigger>hello</tabTrigger> -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
<tabTrigger>ipdb</tabTrigger>
<scope>source.python</scope>
@brianpeiris
brianpeiris / singlequote.js
Last active December 24, 2015 10:19
Node script that converts double quotes to single quotes in JavaScript files.
// Taken from http://ariya.ofilabs.com/2012/02/from-double-quotes-to-single-quotes.html
// Usage:
// $ node singlequote.js <input> [output]
(function () {
'use strict';
var fs = require('fs'),
esprima = require('esprima'),
input = process.argv[2],
output = process.argv[3] || input,