Skip to content

Instantly share code, notes, and snippets.

View dilawar's full-sized avatar
🐕
w**king

Dilawar Singh dilawar

🐕
w**king
View GitHub Profile
@dilawar
dilawar / .screenrc
Created July 6, 2012 01:06 — forked from alexras/.screenrc
My .screenrc file
# Screen Options ##
shell bash # Tell screen your default shell
startup_message off # Turn off start message
defscrollback = 5000
shelltitle '$ |bash' # Dynamic window titled for running program
msgwait 1 # Set messages timeout to one second
nethack on # Turn on nethack error messages
backtick 0 0 0 whoami # Set "%0`" to equal the output of "whoami"
escape ^Oo
@dilawar
dilawar / mysql2sqlite.sh
Created November 18, 2012 19:32 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@dilawar
dilawar / record_my_desktop.sh
Created February 17, 2013 13:58
Record your desktop (no stinking gui). It automatically calculates the screen resolution and saves the video in mkv format.
#!/bin/bash
# This script record your desktop. It calculates your screen resoltion and saves
# the video in ~/Video/output.mkv file.
# dilawar@ee.iitb.ac.in
Xaxis=$(xrandr -q | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1)
Yaxis=$(xrandr -q | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2)
ffmpeg -f x11grab -s $(($Xaxis))x$(($Yaxis)) -r 25 -i :0.0 -sameq ~/Video/output.mkv
@dilawar
dilawar / gcc-bug-60407
Created March 4, 2014 10:20
gcc-bug-60407
This file has been truncated, but you can view the full file.
# 1 "ZombieReac.cpp"
# 1 "/home/dilawar/Work/NCBS/moose_svn1.7/moose/branches/async_multiscale_cmake/ksolve//"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 30 "/usr/include/stdc-predef.h" 3 4
# 1 "/usr/include/i386-linux-gnu/bits/predefs.h" 1 3 4
# 31 "/usr/include/stdc-predef.h" 2 3 4
# 1 "<command-line>" 2
# 1 "ZombieReac.cpp"
# 10 "ZombieReac.cpp"
@dilawar
dilawar / download_youtube_mp3.py
Last active August 29, 2015 14:00
Download video/audio from currently playing youtube video
#!/usr/bin/env python
try:
import ConfigParser as cfg
except:
import configparser as cfg
import os
import json
import sys
M1719: |Labc|Ldce|Ebze| 0.20 0.30 0.32 0.32 0.32 0.32 0.263296394963 0.111387109786 0.470177600114 0.029771700191 0.173209325064 3.28129207574
"""
Animation of a head slicing.
Based on a BSD-like licenced code by Gael Varoquaux
http://docs.enthought.com/mayavi/mayavi/auto/example_mri.html
Result:
http://i.imgur.com/EJZELfi.gif
"""
@dilawar
dilawar / white_noise.py
Last active April 29, 2019 20:34
Create white noise stimulus in python using psychopy
# Generate noise frames
# dependencies: psychopy, python-numpy, python-pyglet
from numpy import random
from psychopy import visual
# create a window
win = visual.Window([800, 600], monitor="testMonitor", units="deg")
maskDuration = 180 # Duration of mask in frames
visualNoiseSize = 512 # Dimension in pixels of visual noise. Must be a power of 2
@dilawar
dilawar / query.py
Created March 10, 2015 10:15
query.py file for ARIDNI
"""query.py:
Searches each row of query sheet in columns of database sheet.
"""
__author__ = "Dilawar Singh"
__copyright__ = "Copyright 2015, Dilawar Singh and NCBS Bangalore"
__credits__ = ["NCBS Bangalore"]
__license__ = "GNU GPL"
@dilawar
dilawar / count_spikes.py
Created June 23, 2015 07:44
count spikes in a list.
def count_spikes(tables, threshold):
'''Count the number of spikes, also pupulate the spikeTables '''
nSpikes = 0
spikeBegin = False
spikeEnds = False
clock = moose.Clock('/clock')
for tname in tables:
t = tables[tname]
dt = clock.currentTime / len(t.vector)
spikeList = []