Skip to content

Instantly share code, notes, and snippets.

View shurane's full-sized avatar

Ehtesh Choudhury shurane

  • Astoria, NY | Seattle, WA
  • 05:43 (UTC -07:00)
View GitHub Profile
@shurane
shurane / main.c
Created June 13, 2015 22:44
ios-unit-0-loops
//
// main.c
// Loops
//
// Created by C4Q on 6/13/15.
// Copyright (c) 2015 C4Q. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
@shurane
shurane / gist:565b05146cd2a899d8fa
Created June 17, 2015 17:54
Second Life LSL script
default
{
collision_start(integer num_detected)
{
rotation avatarRot = llDetectedRot(0);
vector direction = <0.0, 1.0, 0.0> / avatarRot;
vector avatarPos = llDetectedPos(0);
float angle = llAtan2(direction.x, direction.y);
integer directionToPush = llRound(angle * 8 / TWO_PI);
@shurane
shurane / output.sh-session
Last active August 29, 2015 14:25
Confused at Invalid read of size 4?
$ clang++ -Wall -g --std=c++11 test-invalid-read.cpp -o test-invalid-read && valgrind --leak-check=yes ./test-invalid-read
==32099== Memcheck, a memory error detector
==32099== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==32099== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==32099== Command: ./test-invalid-read
==32099==
counter:0
counter:1
==32099== Invalid read of size 4
==32099== at 0x400EAC: Node::serialno() const (test-invalid-read.cpp:18)
@shurane
shurane / test.mask.iteration.ipynb
Created July 18, 2015 15:42
iteration with mask to wrap around indices
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shurane
shurane / formatting.js
Last active September 5, 2015 02:02
saves page offset on long HTML pages. Good for reading articles or e-books.
// so useful for formatting a webpage to X pixels wide and centered. So useful!
document.body.style.maxWidth = "600px"
document.body.style.margin = "0 auto";
@shurane
shurane / jordan-1.nlogo
Created September 7, 2015 03:29
Jordan Smith's progress -- Programming in NetLogo
@shurane
shurane / LICENSE
Last active September 11, 2015 18:13
angularjs lesson plan
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
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:
@shurane
shurane / csvtest.py
Created July 12, 2011 19:00
Question asked earlier today -- but this should be legible and understandable. Everything is outputted to "MQ_List-output.csv"
#!/usr/bin/env python
import csv
import sys
import os.path
#filename1 = csv with all the important rows (inputfile)
#filename2 = csv that sorts filename1 by groups (sortby)
#filename3 = alternate filename, by default it is filename1 appended with '-output.csv' (output_file)
if len(sys.argv) <= 2:
@shurane
shurane / vimrc-vam.vim
Created July 23, 2011 03:06
A simple way to only load the repos I want?
" VAM for plugin management
" after setting this up
function! ActivateVAM()
let addons_base = expand('$HOME') . '/vim-addons'
let addons_manager = addons_base . '/vim-addon-manager'
execute 'set runtimepath+=' . addons_manager
if finddir(addons_base, '') == ''
call mkdir(addons_base, '')
endif