Skip to content

Instantly share code, notes, and snippets.

View eindiran's full-sized avatar

Elliott Indiran eindiran

  • San Francisco, CA
View GitHub Profile
@eindiran
eindiran / extract.sh
Created November 3, 2018 06:35
The 'extract' function for your favorite shell
extract () {
# Extract the contents of a compressed file
# Most common archive types are currently supported
# Support for new types can be added using the "case" block below:
if [ -f "$1" ] ; then
# Check that a file actually exists at $1
echo "Trying to extract file '$1'..."
case "$1" in
*.tar.bz2) tar xvjf "$1" ;;
*.tar.gz) tar xvzf "$1" ;;
@eindiran
eindiran / pause_garbage_collection.py
Created August 8, 2019 20:51
A contextmanager for pausing garbage collection.
"""
pause_garbage_collection
Creates a contextmanager to pause garbage collection.
Garbage may still be collected explicitly via `gc.collect()`
with pause_garbage_collection():
foo()
bar()
"""
@eindiran
eindiran / keybase.md
Created August 20, 2019 17:10
Keybase proof

Keybase proof

I hereby claim:

  • I am eindiran on github.
  • I am eindiran (https://keybase.io/eindiran) on keybase.
  • I have a public key ASCeUhGOouJJHLdz5j6_6EAdj0vzQGZc5p7_AJy1w4eswgo

To claim this, I am signing this object:

@eindiran
eindiran / autohide_panel.sh
Created October 23, 2019 19:36
Toggle the autohide and autohide behavior settings of an XFCE panel
#!/usr/bin/env bash
#===============================================================================
#
# FILE: autohide_panel.sh
#
# USAGE: ./autohide_panel.sh -p <panelId>
#
# DESCRIPTION: Toggle the autohide and autohide behavior properties of an
# XFCE panel, which control whether it is visible or not.
# This script was inspired by the code snippet for autohiding
@eindiran
eindiran / plot_series_convergence.py
Created November 4, 2019 07:54
Create plots of the convergence of Madhava's series and Gregory's series
#!/usr/bin/env python3
"""
plot_series_convergence.py
Plot Gregory's series and Madhava's series
to demonstrate their convergence speed.
Here we refer to Madhava's series as the rapidly converging series
pi = sqrt(12) * (1 - 1/(3 * 3) + 1/(3 * 5^2) - 1/(3 * 7^3))
which is described here:
@eindiran
eindiran / autotoot.py
Last active November 7, 2019 01:22
A quick implementation of a status-posting script for Mastodon.
#!/usr/bin/env python3
# -*- coding: utf8 -*-
"""
Automatically post new articles (in the _posts directory for a Jekyll site) to
a Mastodon instance.
Elliott Indiran <elliott.indiran@protonmail.com>
"""
from pathlib import Path
from typing import Optional
@eindiran
eindiran / plot_series_convergence.py
Created November 10, 2019 09:32
Reimplementation of plot_series_convergence.py using mpmath library for high precision floating-point arithmetic.
#!/usr/bin/env python3
"""
plot_series_convergence.py
Plot Gregory's series and Madhava's series
to demonstrate their convergence speed.
Here we refer to Madhava's series as the rapidly converging series
pi = sqrt(12) * (1 - 1/(3 * 3) + 1/(3 * 5^2) - 1/(3 * 7^3))
which is described here:
@eindiran
eindiran / .alt-vimrc
Created November 12, 2019 21:52
Alternate, light-weight .vimrc
"---------------------------------------------------------------------
"
" FILE: .alt-vimrc
" DESCRIPTION: An alternate .vimrc intended to be extremely
" light-weight. Loads no plugins, etc.
" AUTHOR: Elliott Indiran
"
"---------------------------------------------------------------------
set number
set tabstop=4