Skip to content

Instantly share code, notes, and snippets.

View vmiheer's full-sized avatar

miheer vaidya vmiheer

View GitHub Profile
@vmiheer
vmiheer / rails_installation_ubuntu
Created March 31, 2012 14:13 — forked from techmaniack/rails_installation_ubuntu
Setting up RAILS on Ubuntu
STEP 1:
$ sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
STEP 2:
$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
STEP 3:
git config --global user.name "<name>"
git config --global user.email "<email>"
cat ~/.gitconfig
mkdir git-demo
cd git-demo
git init
touch hello.txt
git add .
git commit -a
vi hello.txt
@vmiheer
vmiheer / p4sync.sh
Last active August 29, 2015 14:15
sync p4 recursively
# we have software depot in perforce //sw/...
# problem is while syncing we get:
# Request too large (over 750000); see 'p4 help maxresults'.
# here is simple function to resolve this:
# if you are using zsh
# $ setopts interactivecomments
sync_p4 ()
{
p4 -r 1 sync $1...$2; # sync $1 at $2 ; possible $2's can be #0 ;) or @my-cl-number
# retry only once
@vmiheer
vmiheer / winctrls.patch
Last active August 29, 2015 14:24
Use monaco font in mintty
Index: winctrls.c
===================================================================
--- winctrls.c (revision 1322)
+++ winctrls.c (working copy)
@@ -829,8 +829,8 @@
cf.hwndOwner = dlg.wnd;
cf.lpLogFont = &lf;
cf.Flags =
- CF_FIXEDPITCHONLY | CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT |
- CF_SCREENFONTS | CF_NOSCRIPTSEL;
@vmiheer
vmiheer / links.md
Created January 16, 2016 16:19
reveal.js tricks
@vmiheer
vmiheer / p4sync.ps1
Last active July 22, 2016 07:28
better p4 sync
function Sync-Perforce($Path)
{
Write-Host $Path
$arguement = "$($Path)/...";
p4 sync $arguement 1>$null 2>&1;
if ($LASTEXITCODE -ne 0) {
$output = & p4 sync $arguement 2>&1;
if ($output.CategoryInfo.TargetName -eq "Request too large (over 750000); see 'p4 help maxresults'.") {
Write-Debug "Request too large! Retrying Subdirs";
$SubDirs = &p4 dirs -C "$($Path)/*"
@vmiheer
vmiheer / DeleteOutlookEvents.ps1
Created February 1, 2017 09:17
Mass delete outlook calender events by subject
$eventSubject = "Subject of event" # replace me with another Subject
$olFolderCalendar = 9
$outlook = New-Object -ComObject Outlook.Application
$namespace = $outlook.GetNamespace('MAPI')
$calender = $namespace.GetDefaultFolder($olFolderCalendar) #
$totalEvents = ($calender.Items | where { $_.Subject -eq $eventSubject}).Count
if ($totalEvents) {
(($calender.Items | where { $_.Subject -eq $eventSubject } )[1..$totalEvents]) | % { $_.Delete() }
}
@vmiheer
vmiheer / cuda_check.py
Created September 21, 2018 19:37 — forked from f0k/cuda_check.py
Simple python script to obtain CUDA device information
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Outputs some information on CUDA-enabled devices on your computer,
including current memory usage.
It's a port of https://gist.github.com/f0k/0d6431e3faa60bffc788f8b4daa029b1
from C to Python with ctypes, so it can run without compiling anything. Note
that this is a direct translation with no attempt to make the code Pythonic.
@vmiheer
vmiheer / SpotifyFG.ps1
Created November 4, 2018 17:20
Get spotify to foreground
# https://blogs.technet.microsoft.com/heyscriptingguy/2007/02/03/hey-scripting-guy-how-can-i-use-windows-powershell-to-get-a-list-of-all-the-open-windows-on-a-computer/
# https://stackoverflow.com/questions/4993926/maximize-window-and-bring-it-in-front-with-powershell
# Needs Powershell community extentions
Set-ForegroundWindow (get-process Spotify | Where-Object {$_.MainWindowTitle -ne ""}).MainWindowHandle
@vmiheer
vmiheer / FindSpillOffsets.py
Last active March 15, 2019 21:25
Find set of spill locations from icc assembly output
# License: GPL
# Copyright: Miheer Vaidya (vaidya.56@osu.edu)
import sys
import re
def getSpillOffsets(f) -> set:
"""
Given file `f' returns set of offsets of spill locations
"""
pattern = re.compile(r".* (-?\d+\(%rsp\)).*")