Skip to content

Instantly share code, notes, and snippets.


Efrem Rensi ebrensi

View GitHub Profile
ebrensi /
Created Jun 9, 2022
Bash script to start tmux with
# open a split-window tmux session with
# backend server in one pane and
# parcel watch frontend builder in the other
sessionexists=$(tmux list-sessions | grep $session)
ebrensi / LiveParams.ts
Last active Apr 15, 2022
JavaScript (TypeScript) Object extended with onChange method
View LiveParams.ts
* An Object with an onChange method and debounced callbacks.
* Example:
* ```
* type P = {name: string, age: number, birthday: Date}
* const live_obj = const watch<P>({ name: "Doctor Foo", age: 43 })
* live_obj.onChange("name", (newVal: string) => { console.log("yo! name=${newVal} now!") })
* ```
* !!! In order for types to work correctly, instantiate a LiveParams object using the `watch<P>()`
* factory function rather than `new LiveParams<P>()`.
ebrensi / hide-trolls.js
Created Sep 1, 2021
Hide posts from certain authors on message forum (
View hide-trolls.js
* Run this in your browser when you're at,
* either directly in the console (ctrl-shift-i)
* or via a userscript extension like Tampermonkey
// Author names of trolls you want to hide
toHide = ["troll guy", "other troll"]
document.querySelectorAll(".author-name").forEach(el => {
ebrensi /
Last active Oct 29, 2020
Some mods to jakearchibald/idb-keyval that make it faster


idb-keyval is a tiny TypeScript library by Jake Archibald that simplifies usage of IndexedDB as a client-side key-value store. His repo includes a few JavaScript builds for different use cases.


I submitted this as a pull-request (see #91) but it appears not much is happening with that repo right now, so here is the essential part of my pull request for anyone to use.

The original idb-keyval opens a new transaction for every (get, set, or del) operation, which is inefficient for performing lots of opertations. One alternative is to use a more full-featured library like IDB or Dexie, which feature batch operations that perform several in the same transaction. This mod maintains the original i

ebrensi /
Last active Apr 2, 2020
Sublime Text 3 plugin to select a color scheme for the current tab only


Put in the folder that opens up when you select Preferences > Browse Packages...

Now you have a command called change_tab_color_scheme that you can access from the command window. You can set a key binding by going to Preferences > Key Bindings

I personally like the "ctrl+k", "ctrl+c" sequence.

ebrensi /
Created May 2, 2019
Automatic Stylus (Pen) Rotate Orientation
# Automatic stylus (pen) orientation for HP Spectre x360
# adapted by Efrem Rensi
# This is a fix for an apparent bug in Cinnamon whereby System Settings >> General >> Automatic Screen Rotation
# Rotates the screen and touch functionality, but the pen orientation does not rotate
# Based on chadm's script at
# Receives input from monitor-sensor (part of iio-sensor-proxy package) and sets the touchscreen
# orientation based on the accellerometer positionn. We assume that the display rotation is
ebrensi / L.Control.fps.js
Created Feb 20, 2017
fps display control for leaflet.js
View L.Control.fps.js
/* fps display control for leaflet*/
/* Efrem Rensi 2017/2/19 */
L.Control.fps = L.Control.extend({
lastCalledTime: 1,
options: {
position: "topright"
ebrensi /
Last active Jun 10, 2016
Scrapy extension to keep Heroku awake when running scrapyd
import logging
from twisted.internet import task
from twisted.web.client import getPage
from scrapy import signals
from scrapy.exceptions import NotConfigured
logger = logging.getLogger(__name__)