Skip to content

Instantly share code, notes, and snippets.

View scarlac's full-sized avatar

Seph Soliman scarlac

View GitHub Profile
# Retain all history, allow search
setopt APPEND_HISTORY
setopt histignorealldups
bindkey -e
bindkey '^R' history-incremental-search-backward
# Terminal prompt to show exit code and time
# e.g. 9:59:59 ~/ ⚡️
PROMPT='%* %F{magenta}%4~%f %(?.⚡️.💥) '
RPROMPT=''
@scarlac
scarlac / noNewTabs.js
Last active April 26, 2026 19:12
UserScript for forcing links to open in the same tab
// ==UserScript==
// @name Force links to open in same window
// @namespace https://github.com/scarlac
// @version 1.1.0
// @description Rewrite target="_blank" (and similar) on links, areas, forms, and base tags so navigation stays in the current window/tab. Does not touch window.open or other JS APIs.
// @author scarlac
// @match *://*/*
// @run-at document-start
// @grant none
// @noframes
@scarlac
scarlac / gist:ceae8766ced23740817ad6ba173c8e48
Last active February 16, 2026 07:21
UserStyle: Remove YouTube shorts & "Next video" suggestions
/* ==UserStyle==
@name Remove Shorts & Next Video (CSS)
@description This is your new file, start writing code
@match https://*.youtube.com/*
==/UserStyle== */
.ytd-reel-shelf-renderer,
ytd-rich-shelf-renderer[is-shorts] {
display: none;
}
@scarlac
scarlac / gist:d58a5966c97dfa743b0a7bbae7d84445
Created February 16, 2026 07:18
UserScript to remove Facebook Reels from your feed
// ==UserScript==
// @name No FB shorts
// @match https://www.facebook.com/*
// ==/UserScript==
setInterval(() => {
Array.from(document.querySelectorAll('span')).filter(e => e.innerText === 'Reels').forEach(el => el.closest('[data-pagelet^="FeedUnit_"]')?.remove());
}, 1000)
@scarlac
scarlac / react-native+0.81.4.patch
Last active September 19, 2025 20:53
Fixes Switch not being clickable/wrong size: https://github.com/facebook/react-native/issues/53537
diff --git a/node_modules/react-native/Libraries/Components/Switch/Switch.js b/node_modules/react-native/Libraries/Components/Switch/Switch.js
index d3b88af..436a4bf 100644
--- a/node_modules/react-native/Libraries/Components/Switch/Switch.js
+++ b/node_modules/react-native/Libraries/Components/Switch/Switch.js
@@ -260,11 +260,14 @@ const Switch: component(
/>
);
} else {
+ const switchSizeGteIos26 = { width: 63, height: 28 };
+ const switchSizeLteIos18 = { width: 51, height: 31 };
@scarlac
scarlac / purge_advertisers.md
Last active December 4, 2024 21:57
Facebook Hack: Purge list of "Advertisers you've interacted with"

For those of you who want to remove all in “Advertisers and Businesses” / "Who uploaded a list with your info and advertised to it":

  1. Go to https://www.facebook.com/ads/preferences/?entry_product=ad_settings_screen and open the section "Advertisers you've interacted with"
  2. Collapse all sections but keep "Advertisers and Businesses" open
  3. Open Web Inspector
  4. Copy-paste this script to load all advertisers: smt=setInterval(() => {let x=document.querySelector('div[shade=medium]'); x ? x.click() : clearInterval(smt), console.log('done')}, 1000)
  5. It will output a number. Wait for it to say “done” in the console. This may take a long time. you'll notice the scrollbar changing while it's loading all advertisers.
  6. Copy-paste this and press enter:
@scarlac
scarlac / .zshrc
Created October 11, 2023 16:52
Keep Android phone screen on while connected to your computer
# similar to the old 'caffeinate' command for macOS, this will keep the connected android phones active
alias caffeinate-android='while true; do adb -d shell input keyevent mouse ; sleep 10 ; done'
@scarlac
scarlac / caffeinate-android.sh
Created July 20, 2023 22:18
Keep your Android device unlocked while developing. Works like 'caffeinate' on macOS
# add this to your mac's ~/.zshrc
alias caffeinate-android='while true; do adb -d shell input keyevent mouse; sleep 10; done'
@scarlac
scarlac / convert-persist-state-to-json.js
Last active January 12, 2023 19:51
Redux Persist script that convert the double-encoded persisted reducer state files into normal JSON files
/* eslint-disable no-console */
const fs = require('fs');
const path = require('path');
/**
* Redux Persist script that convert the double-encoded persisted reducer state files into normal JSON files.
* Usage: node convert-persist-state-to-json.js /tmp/Documents/persistStore
* generates several files:
* persistStore/persist-root -> persistStore/persist-root.json
* persistStore/persist-user -> persistStore/persist-user.json
diff --git a/node_modules/@nozbe/watermelondb/native/android-jsi/src/main/java/com/nozbe/watermelondb/jsi/JSIInstaller.java b/node_modules/@nozbe/watermelondb/native/android-jsi/src/main/java/com/nozbe/watermelondb/jsi/JSIInstaller.java
index 055cede..8dc52e6 100755
--- a/node_modules/@nozbe/watermelondb/native/android-jsi/src/main/java/com/nozbe/watermelondb/jsi/JSIInstaller.java
+++ b/node_modules/@nozbe/watermelondb/native/android-jsi/src/main/java/com/nozbe/watermelondb/jsi/JSIInstaller.java
@@ -14,8 +14,7 @@ class JSIInstaller {
// Helper method called from C++
static String _resolveDatabasePath(String dbName) {
- // On some systems there is some kind of lock on `/databases` folder ¯\_(ツ)_/¯
- return context.getDatabasePath(dbName + ".db").getPath().replace("/databases", "");