Skip to content

Instantly share code, notes, and snippets.

@jthodge
jthodge / universal-switcher
Created September 6, 2020 22:07
Show macOS app switcher across all monitors
defaults write com.apple.Dock appswitcher-all-displays -bool true
killall Dock
@meereeum
meereeum / arxivate.sh
Last active December 4, 2019 23:39
bash util for making your tex arXivable
#!/usr/bin/env bash
# this script gets your latex ready for arxiv submission by
# (1) sanitizing your *.tex of embarrassing comments,
# (2) arxiv-proofing filenames, &
# (3) gzipping everything needed into a convenient .tar.gz
HELPFLAG="-h"
FIGFLAG="-d"
OUTFLAG="-o"
echo "buckets logging to a folder other than <theirname>/:"
for bucket in $(aws s3 ls | awk '{print $3}')
do
bucket_status=$(aws s3api get-bucket-logging --bucket $bucket | grep -v "$bucket/")
if [[ $bucket_status != "" ]]; then
echo "\t$bucket"
fi
done
echo "buckets logging to a bucket other than s3.bucket.access.logs:"
@lyahdav
lyahdav / phabricator-diff-lines-modified.js
Last active January 27, 2021 20:34
Tampermonkey script to Show Total Number of Lines Modified in Phabricator Diff
// ==UserScript==
// @name Show Total Number of Lines Modified in Diff
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Show total number of lines modified in diff at bottom of table of contents
// @author lyahdav
// @match UPDATE HERE e.g. https://phab.example.com/D*
// @grant none
// ==/UserScript==
@moklett
moklett / task1.exs
Last active April 18, 2023 19:58
Elixir Task - Crash Handling
# This demonstrates that, when using async/await, a crash in the task will crash the caller
defmodule Tasker do
def good(message) do
IO.puts message
end
def bad(message) do
IO.puts message
raise "I'm BAD!"
end

Setup

curl -sSL -o clone.c goo.gl/G45N5X

Net Namespace

# on host
@sevko
sevko / README.md
Created September 3, 2015 16:47
simple Python raytracer

raytracer

A simple Python raytracer that supports spheres with configurable "material" properties (base color and a bunch of light coefficients). To generate a raytraced image of the pre-defined scene, run: python raytracer.py and open image.ppm with a PPM-compatible viewer (eog works fine on Linux):

raytraced spheres

acknowledgements

I found the following resources extremely helpful:

@gubatron
gubatron / compiling_building_c_cpp_notes.md
Last active April 18, 2024 07:58
Things to remember when compiling and linking C/C++ programs

Things to remember when compiling/linking C/C++ software

by Angel Leon. March 17, 2015;

Last update on December 14, 2023

Updated on February 27, 2023

Updated August 29, 2019.

#! /bin/zsh
TIME=$1
FNAME=$2
# if [[ $# != 3]] then;
# echo "USAGE: $0 time_interval filename"
# exit 2
# fi
if [[ -f $FNAME ]]; then
@ericdouglas
ericdouglas / super-tip.txt
Last active February 25, 2024 10:09
Change 4 spaces to 2 spaces indentation and change tab to spaces - Vim tip
// 4 spaces to 2 spaces
%s;^\(\s\+\);\=repeat(' ', len(submatch(0))/2);g
// Tab to 2 spaces
:%s/\t/ /g