Skip to content

Instantly share code, notes, and snippets.

@ibrahima
ibrahima / spamclasses.rb
Created March 5, 2012 23:11
A script that creates a bunch of classes for testing pagination
for k in 0..99
c = Course.new
c.term = "Spring"
c.year = 2012
c.title = "EECS 1" + sprintf("%02d", k)
c.description = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
c.save
cm = CourseMembership.new
cm.user = User.first
cm.course = c
# encoding: utf-8
class ImageUploader < CarrierWave::Uploader::Base
attr_reader :file
include CarrierWave::RMagick
include Magick
storage :file
@ibrahima
ibrahima / .bashrc
Created June 14, 2012 00:58
My .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@ibrahima
ibrahima / request_queue.py
Created July 20, 2012 22:21
A silly class that lets you use Grequests in a somewhat similar manner as the ruby gem Typhoeus
import grequests
from collections import deque
class RequestQueue(object):
"""
This is a lame imitation of a Typhoeus Hydra using GRequests.
The main thing this allows is building up a queue of requests and then
executing them, and potentially adding requests to the queue in a callback
so that you can build requests that depend on other requests more naturally.
@ibrahima
ibrahima / dmesg
Created August 28, 2012 07:57
S-Pen error logs
170.365193] c0 [E-PEN] wacom_i2c_coord failed to read i2c.L521
<7>[ 170.386588] c3 [E-PEN] pdct 0(0)
<7>[ 170.386613] c3 [E-PEN] forced_hover
<6>[ 170.575035] c0 pet_watchdog_timer_fn kicking...c033
<6>[ 170.770177] c0 [E-PEN]: wacom_i2c_query: 0th ret of wacom query=-6
<6>[ 170.770265] c0 [E-PEN]: wacom_i2c_query: 1th ret of wacom query=-6
<6>[ 170.770350] c0 [E-PEN]: wacom_i2c_query: 2th ret of wacom query=-6
<6>[ 170.770430] c0 [E-PEN]: wacom_i2c_query: 3th ret of wacom query=-6
<6>[ 170.770513] c0 [E-PEN]: wacom_i2c_query: 4th ret of wacom query=-6
<6>[ 170.770597] c0 [E-PEN]: wacom_i2c_query: 5th ret of wacom query=-6
@ibrahima
ibrahima / logcat.txt
Created August 28, 2012 18:25
Galaxy Note 10.1 Boot Errors
This file has been truncated, but you can view the full file.
--------- beginning of /dev/log/main
V/AudioPolicyManagerBase( 4753): getDeviceForStrategy() strategy 2, device 2
V/AudioPolicyManagerBase( 4753): getDeviceForStrategy() strategy 0, device 2
V/AudioPolicyManagerBase( 4753): getDeviceForStrategy() strategy 3, device 2
V/AudioPolicyManagerBase( 4753): getDeviceForStrategy() strategy 4, device 2
@ibrahima
ibrahima / noisy-make.bash
Created October 29, 2012 23:36
A function that lets you call make and have it play a sound on successful or unsuccessful completion.
function make(){
/usr/bin/make "$@"
EXITCODE=$?
QUIET=false
OPTIND=1
while getopts ":q" opt; do
case $opt in
q)
QUIET=true
;;
@ibrahima
ibrahima / gitdiff.sh
Created November 28, 2012 06:04
slightly simplified git diff
#!/usr/bin/env sh
git diff --cached --word-diff=porcelain -b --no-prefix | grep "^[\+\-][^\+\-]"
@ibrahima
ibrahima / Link.html
Created November 29, 2012 09:02
Bookmarklet for embedding diff views into Github commit log pages.
(defun goto-student-feedback ()
(interactive)
(string-match
(rx (group "hw" digit) (any ascii) (group "cs30f" (1+ alpha)))
(buffer-file-name))
(let* (
(hwnum (match-string 1 (buffer-file-name)))
(username (match-string 2 (buffer-file-name)))
(feedback-path (concat "/home/linux/ieng6/cs30f/public/" hwnum "_feedback/style_feedback_" username))