Instantly share code, notes, and snippets.

• Sort options

# Gaurav Kamathst0le

View keybase.md

### Keybase proof

I hereby claim:

• I am ST0LE on github.
• I am gauravkamath (https://keybase.io/gauravkamath) on keybase.
• I have a public key whose fingerprint is AC20 EC1E 4274 DA5F 32E4 4704 B9C9 97B3 05BE A391

To claim this, I am signing this object:

View Find-FirstItem.ps1
 Function Find-FirstItem { [CmdletBinding()] [Alias("ffi")] param( [Parameter(Mandatory, Position = 0)] [ValidateNotNullOrEmpty()] [string] \$Filter ) Get-ChildItem -Recurse -Filter \$Filter | Select-Object -First 1 -ExpandProperty FullName }
View ThreeSum.java
 // Complexity - O(n^2), Space Complexity - O(n^2) private int[] findTriple_3(int[] A) { Map map = new HashMap(); for (int i = 0, l = A.length; i < l; i++) { map.clear(); for (int j = i + 1; j < l; j++) { if (map.containsKey(A[j])) { int[] pair = map.get(A[j]); return new int[]{pair[0], pair[1], A[j]};
View Systray.cs
 using System; using System.Drawing; using System.Windows.Forms; namespace MyTrayApp { public class SysTrayApp : Form { [STAThread] public static void Main()
View ThreeSum.java
 // Complexity - O(n^2 logn) private int[] findTriple_2(int[] A) { Arrays.sort(A); // O(nlogn) for (int i = 0, l = A.length; i < l && A[i] < 0; i++) { //O(n^2 logn) for (int j = i + 1; j < l && A[i] + A[j] < 0; j++) { int k = Arrays.binarySearch(A, j + 1, l, -A[i] - A[j]); if (k > j) return new int[]{A[i], A[j], A[k]}; } } return null;
View MediaKeys.ahk
 ; ^ = Ctrl ; volume up ^Numpad8::Volume_Up ; volume down ^Numpad2::Volume_Down ; volume mute ^Numpad0::Volume_Mute
View autoexec.cfg
 alias +jumpthrow "+jump;-attack" alias -jumpthrow "-jump" bind mouse3 +jumpthrow bind mouse5 +voicerecord alias +fwdjumpthrow "+forward;+jump;-attack" alias -fwdjumpthrow "-forward;-jump" bind capslock +fwdjumpthrow exec buyscript; alias +djump "+jump; +duck" alias -djump "-jump; -duck"
View huffman.py
 from collections import Counter from heapq import heapify, heappop, heappush s = input() c = Counter(s) pq = [(c[k], k, None, None) for k in c] codes = {} heapify(pq) while len(pq) > 1: r = heappop(pq)
View dsalgo.md

# Distributed doubly linked list sum

## You are given a doubly linked list whose nodes are distributed. Every node has n

View list_dupes.py
 import hashlib, os unique = dict() for filename in os.listdir('.'): if os.path.isfile(filename): filehash = hashlib.md5(open(filename, 'rb').read()).hexdigest() if filehash not in unique: unique[filehash] = filename else: print (filename + ' is a duplicate of ' + unique[filehash])