This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git | |
alias gs='git status' | |
alias gd='git diff' | |
alias gds='git diff --staged' | |
alias gcom='git checkout master' | |
alias gco='git checkout' | |
alias gp='git pull' | |
alias git-deleted='git log --diff-filter=D --summary' | |
# utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A simple assertion library for jq (https://github.com/stedolan/jq) | |
# Author: Srinath Sankar | |
def assert(level; expr; msg): | |
if expr then | |
. | |
else | |
. |= . + [{ level: level, message: msg }] | |
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Function to automatically create a user_id column for new tables with name starting with user_ | |
create or replace function create_user_id_column() | |
returns event_trigger | |
language plpgsql volatile as | |
$$ | |
declare | |
obj record; | |
identity text[]; | |
begin | |
for obj in select * from pg_event_trigger_ddl_commands() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WebSocketProxy = new Proxy(window.WebSocket, { | |
construct(target, args) { | |
console.log("Proxying WebSocket connection", ...args); | |
const ws = new target(...args); | |
// Configurable hooks | |
ws.hooks = { | |
beforeSend: () => null, | |
beforeReceive: () => null | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove posts marked as "Ad" | |
(() => { | |
const adSel = `[data-testid=placementTracking]` | |
const targetNode = document.querySelector(`body`) | |
const observer = new MutationObserver((mutations) => { | |
for (const m of mutations) { | |
m.addedNodes.forEach(node => { | |
if (ad = node.querySelector(adSel)) { | |
ad.remove(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from playhouse.sqliteq import SqliteQueueDatabase | |
db = SqliteQueueDatabase( | |
"products.db", | |
autostart=True, | |
pragmas={ | |
"journal_mode": "wal", | |
"cache_size": -1024 * 32, | |
"foreign_keys": 1, | |
"ignore_check_constraints": 0, |
OlderNewer