Skip to content

Instantly share code, notes, and snippets.

Avatar

Elliott Indiran eindiran

  • Promptu Systems
  • San Francisco, CA
View GitHub Profile
@eindiran
eindiran / .alt-vimrc
Created Nov 12, 2019
Alternate, light-weight .vimrc
View .alt-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
@eindiran
eindiran / plot_series_convergence.py
Created Nov 10, 2019
Reimplementation of plot_series_convergence.py using mpmath library for high precision floating-point arithmetic.
View plot_series_convergence.py
#!/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 Nov 7, 2019
A quick implementation of a status-posting script for Mastodon.
View autotoot.py
#!/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 Nov 4, 2019
Create plots of the convergence of Madhava's series and Gregory's series
View plot_series_convergence.py
#!/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 / autohide_panel.sh
Created Oct 23, 2019
Toggle the autohide and autohide behavior settings of an XFCE panel
View autohide_panel.sh
#!/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
View keybase.md

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 / pause_garbage_collection.py
Created Aug 8, 2019
A contextmanager for pausing garbage collection.
View pause_garbage_collection.py
"""
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 / extract.sh
Created Nov 3, 2018
The 'extract' function for your favorite shell
View extract.sh
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" ;;