Skip to content

Instantly share code, notes, and snippets.

@squidarth
squidarth / unmute_applescript
Last active June 15, 2023 14:15
Script for opening window and unmuting Google Meet
-- Zoom Version
on run
tell application "zoom.us"
activate
tell application "System Events" to tell process "zoom.us" to keystroke "a" using {shift down, command down} -- Mute/Unmute command in Zoom
end tell
end run
-- Google Meet Version
@squidarth
squidarth / blokus_problem.md
Last active July 8, 2018 20:07
Description of the "Blockus" Problem

The Problem

Blokus is a fun game that involves placing different size/shape/color pieces on a board.

The pieces look like this:

img_9384

img_2166

@squidarth
squidarth / reborrow.rs
Last active June 5, 2018 19:40
Demonstration of reborrowing
fn incr_int(a: &mut u32) {
*a += 1;
}
fn main() {
let mut a = 42;
let mut_ref = &mut a;
incr_int(&mut *mut_ref);
incr_int(&mut *mut_ref);
@squidarth
squidarth / consistent_printer.hs
Created April 9, 2018 01:43
Haskell program to consistently print lines
import System.Environment
import Data.List.Split
import Data.List
import Data.List.Utils (replace)
import Data.String.Utils (strip)
getStringList :: String -> [String]
getStringList str = splitOn " " str
-- costAtJ is the cost incurred by placing a newline
@squidarth
squidarth / consistent_printer.py
Created April 8, 2018 05:00
A program that breaks a string and prints words consistently
# Usage: python consistent_printer.py max_line_length file_path
# Summary: Prints out the contents of a file given a max line length,
# ensuring that the space at the end of each line is minimal.
# Example: `python consistent_printer.py 100 words.txt`
import sys
def get_consistent_lines(max_line_length, string):
# This function takes a string and a maximum line length,
# and returns a string with newlines inserted such that
@squidarth
squidarth / .zshrc
Created February 2, 2018 17:06
zsh fzf history search
fzf-history-widget() {
local selected restore_no_bang_hist
if selected=$(fc -l 1 | fzf +s --tac +m -n2..,.. --tiebreak=index --toggle-sort=ctrl-r -q "$LBUFFER"); then
num=$(echo "$selected" | head -1 | awk '{print $1}' | sed 's/[^0-9]//g')
LBUFFER=!$num
if setopt | grep nobanghist > /dev/null; then
restore_no_bang_hist=1
unsetopt no_bang_hist
fi
zle expand-history
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOJ2sQjki/M9D/SGO6GWolBAI78OYGmwnD5eFaUbbfJVb0ds+hqf2fmLDu5OftJejPavRUpCKupYR3kTZ7fvlXKxt4K830frdDYu3Bf8h/vEtBzLh3nIHeeAPW5widMuOpaTwKZMgG//ryiRlgnI+UTorsWYU05ZkJsEvQMacYinIkkG+0OFjCyKbDqK+pfGzkOrEYFSTE38xaIQSQONtG1a1zIyQVn5VsWK3Zy8h/3ouDc+TP170b2XypPc24mmA+pMLNgMTtSjzE/aSLqV7Gntx83Xx3UOMi806qiRatH50DFJ+aCa9kTUGhrL/jwkRO4jYrnE5cW+Oy1kY4nIQ1 sidharthshanker@ts-macbook-pro
@squidarth
squidarth / gist:41f2dc6d127755958217
Created December 27, 2014 09:44
Errors with fig setup

Errors for fig run web goose up

...
Step 8 : RUN godep restore
 ---> Running in aad26f30bad2
 ---> 6d9639abe01c
Removing intermediate container aad26f30bad2
Successfully built 6d9639abe01c
Verifying that +squidarth is my Bitcoin username. You can send me #bitcoin here: https://onename.io/squidarth
#!/bin/bash
i=0
files=()
for file in $(find ./spec -name "*_spec.rb")
do
if [ $(($i % $CIRCLE_NODE_TOTAL)) -eq $CIRCLE_NODE_INDEX ]
then
files+=" $file"
fi
((i++))