Skip to content

Instantly share code, notes, and snippets.

Avatar

Efrem Rensi ebrensi

View GitHub Profile
@ebrensi
ebrensi / README.md
Last active Oct 29, 2020
Some mods to jakearchibald/idb-keyval that make it faster
View README.md

idb-keyval

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.

idb-keyval-alt.js

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
ebrensi / README.md
Last active Apr 2, 2020
Sublime Text 3 plugin to select a color scheme for the current tab only
View README.md

Installation

Put change_tab_color_scheme.py 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
ebrensi / stylus-rotate.sh
Created May 2, 2019
Automatic Stylus (Pen) Rotate Orientation
View stylus-rotate.sh
#!/bin/sh
# 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 https://linuxappfinder.com/blog/auto_screen_rotation_in_ubuntu.
# 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
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
ebrensi / extensions.py
Last active Jun 10, 2016
Scrapy extension to keep Heroku awake when running scrapyd
View extensions.py
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__)