Skip to content

Instantly share code, notes, and snippets.

View rajiteh's full-sized avatar
🅱️
'sup

Raj Perera rajiteh

🅱️
'sup
  • @ubisoftinc
  • Toronto, ON
View GitHub Profile
@rajiteh
rajiteh / grunt.js
Created March 21, 2013 01:09
My grunt config template complete with less and coffee script lint
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-recess');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-coffeelint');
var recessOptions = function(bool) {
bool = ((typeof bool === 'undefined')? false : bool);
var config = {
@rajiteh
rajiteh / seedstop.py
Last active December 23, 2015 20:59
Automatically stop seeding transmission downloads (DONT USE THIS CODE!)
#!/usr/bin/env python
import transmissionrpc
import logging
import logging.handlers
LOG_FILE = '/root/logs/seedstop.log'
logger = logging.getLogger('Seedstop')
logger.setLevel(logging.INFO)
#!/bin/bash
# Logging helper for bash scripts.
# Written by Raj Perera <rajiteh@gmail.com>
# This code is MIT Licensed. (http://opensource.org/licenses/MIT)
# Usage
# * Include this script at the header of your primary script.
# $ source "inc.logger.sh"
# * Use log, log_info, log_warn, log_fatal functions to perform your logging.
@rajiteh
rajiteh / permissions.sh
Created February 6, 2014 19:44
find and update permissions
find * ! -user admin ! -user root -user nobody -type d -maxdepth 1 -exec chown -R DOMAIN\\{}:DOMAIN\\domain\ users {} \; -exec chmod -R 640 {} \; -exec echo "[" `date -Iseconds` "]: PERMISSIONS UPDATED FOR " {} \;
@rajiteh
rajiteh / sfpawards.js
Created September 9, 2014 09:16
Hover over the Award link text instead of opening a popup window to quickly read award descriptions in YorkU's SFP application.
//Execute the following javascript at the Award selection page of SFP and wait for the message 'success! :)'
var script = document.createElement("script");
script.src = "https://code.jquery.com/jquery-2.1.1.min.js";
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);
var interval = setInterval(function() {
if (typeof jQuery === "function") {
clearInterval(interval);
jQuery(function($) {
var $dom = $('a[target="awardDescription"]')
#!/bin/bash
#mongod on terminal with logging to stdout (so dirty it smells)
#alias to 'mongod' for extra points
tail -f /usr/local/var/log/mongodb/mongo.log &;mongod --config /usr/local/etc/mongod.conf;kill $(ps | grep 'tail -f /usr/local/var/log/mongodb/mongo.log' | head -1 | awk '{ print $1 }')
#!/bin/sh
#Get sudo
sudo echo
switch_version()
{
select version
do
echo
#!/bin/sh
# http://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommited-changes
require_clean_work_tree () {
# Update the index
git update-index -q --ignore-submodules --refresh
err=0
# Disallow unstaged changes in the working tree
if ! git diff-files --quiet --ignore-submodules --; then
#!/bin/bash
# usage: script.name <url_to_ping>
url=$1
while true
do
curl -iI $url
sleep 60
done
@rajiteh
rajiteh / PGSQL_INSERT_IGNORE.SQL
Created December 12, 2014 04:50
Postgres way of doing mysql insert ignore
INSERT INTO ew_events (
id,
name,
CONTENT,
url,
img,
LOCATION,
lat,
lng,
date_start,