Skip to content

Instantly share code, notes, and snippets.

View brianpeiris's full-sized avatar

Brian Peiris brianpeiris

View GitHub Profile
@brianpeiris
brianpeiris / bash.sh
Last active February 6, 2021 07:23
Bash Cheatsheet
# Because I always forget this stuff
# Run a command in the background with its output redirected
<command> > /dev/null 2>&1 &
# A while loop
while true; do
echo 'hi';
sleep 1;
done
curl -Sso ~/.vimrc https://raw.github.com/brianpeiris/vimrc/master/.vimrc
mkdir ~/.tmp
mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -Sso ~/.vim/autoload/pathogen.vim \
https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
cd ~/.vim/bundle
git clone https://github.com/scrooloose/syntastic.git
@brianpeiris
brianpeiris / resourceRefresh.js
Last active December 17, 2015 06:28
ResourceRefresh is a small, unobtrusive JavaScript file that pings your development server for changes to your HTML, CSS and JavaScript files. As soon as you save a file, the changed file is injected/refreshed without you having to refresh your browser manually. Based on CSSrefresh v1.0.1 (Copyright (c) 2012 Fred Heusschen www.frebsite.nl)
/*
* ResourceRefresh v0.1.0
*
* Based on CSSrefresh v1.0.1 (Copyright (c) 2012 Fred Heusschen www.frebsite.nl)
*
* Dual licensed under the MIT and GPL licenses.
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*/
@brianpeiris
brianpeiris / gist:5359550
Last active December 16, 2015 02:00 — forked from amkaos/gist:5357240
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
@brianpeiris
brianpeiris / ThrottleMill.py
Last active December 14, 2015 18:09
Files for my TreadScroll blog post
import serial
class ThrottleMill:
def __init__(self):
self.port = serial.Serial("/dev/ttyUSB0", timeout=0)
self.port.flushInput()
self.treaded = 0
def update(self):
@brianpeiris
brianpeiris / sysinternals_download.bat
Created March 2, 2013 18:59
Simple batch file to download all Sysinternals tools to current directory
@echo off
echo Updating...
REM Open explorer to establish access to the share
explorer \\live.sysinternals.com\tools
REM Copy the tools to the current directory
robocopy \\live.sysinternals.com\tools .
@brianpeiris
brianpeiris / PubNubScroll.py
Last active December 13, 2015 16:39
A bit of Python code for listening to events from a PubNub channel and triggering a mouse wheel scroll event.
from Pubnub import Pubnub
from datetime import datetime
from guippy import mouse
subkey = '<your subcribe key>'
pubkey = '<your publish key>'
channel = '<your channel name>'
pubnub = Pubnub(pubkey, subkey, None, False)
@brianpeiris
brianpeiris / install-pip.ps1
Created February 7, 2013 04:11
Powershell script for installing pip.
(new-object net.webclient).downloadfile('http://python-distribute.org/distribute_setup.py', "$pwd\distribute_setup.py")
python .\distribute_setup.py
(new-object net.webclient).downloadfile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', "$pwd\get-pip.py")
python .\get-pip.py
rm distribute-*.gz
rm distribute_setup.py
rm get-pip.py
@brianpeiris
brianpeiris / Librarify.js
Created February 6, 2013 03:30
Librarify: A bookmarklet that injects JavaScript libaries into any page. Based on Rey Bango's jQuerify: http://blog.reybango.com/2010/09/02/how-to-easily-inject-jquery-into-any-web-page/
// Librarify: A bookmarklet that injects JavaScript libaries into any page.
// Based on Rey Bango's jQuerify: http://blog.reybango.com/2010/09/02/how-to-easily-inject-jquery-into-any-web-page/
javascript: (function (libname) {
var
libraries = {
jquery: {
url: '//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js',
libvar: '$'
},
@brianpeiris
brianpeiris / GitCheatsheet.md
Created January 5, 2013 17:26
Git/GitHub Cheatsheet

Git/GitHub cheat sheet

Setup and Usage

Install git

sudo apt-get install git

Set the default name and email for git to use when you commit

git config --global user.name "Your Name Here"