Skip to content

Instantly share code, notes, and snippets.

@cbadke
cbadke / gist:4990286
Last active December 13, 2015 23:18
Scan files for unique guids. Generate replacements. Replace each guid in all files, committing between each guid.
param (
[string] $path
)
$oldPath = $pwd
cd (Resolve-Path $path)
$files = grep -rIlE "[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{12\}" * |
? { !$_.Contains('.min.js') } |
private static void descriptiveImp()
{
var weatherData = File.ReadAllLines(@"C:\weather.dat");
Func<string,DataPoint> ConvertLineToDataPoint = line => {
var currLine = line.Trim().Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
return new DataPoint
{
day = Int32.Parse(currLine[0]),
max = Int32.Parse(currLine[1]),
@cbadke
cbadke / PrimeFetcher.fs
Created November 23, 2012 00:35
Fetch Primes Attempt 1
module PrimeFetcherFSharp
let FetchPrimesUpTo (max : int) : int[] =
match max with
| x when x < 2 -> [||]
| x when x = 2 -> [|2|]
| x when x < 5 -> [|2; 3|]
| _ ->
let candidates = [|for x in 0 .. max -> if x < 2 then 0 else x|]
let RemoveMultiples (coll : int[]) (x : int) =
@cbadke
cbadke / gist:3430364
Created August 22, 2012 22:51
c# git ignore
#ignore thumbnails created by windows
Thumbs.db
#ignore vim swap files
*.swp
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
@cbadke
cbadke / gist:1955322
Created March 2, 2012 03:23
tmux config
bind | split-window -h
bind - split-window -v
# Set status bar
set -g status-bg black
set -g status-fg green
#set -g status-left '#[fg=green]#H'
set -g status-right-length 50
set -g status-left-length 50
set -g status-right '[#[fg=yellow]#(date +"%H:%M")#[fg=green]]'