Skip to content

Instantly share code, notes, and snippets.

View eth-p's full-sized avatar

Ethan P. eth-p

View GitHub Profile
/**
* Test V8 optimization against eval and new Function
* Run with: node --allow-natives-syntax evalFuncOpt.js
* More verbose with: node --trace_opt --trace_deopt --allow-natives-syntax evalFuncOpt.js
*
* More info at: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers
*/
var b = 0;
function getStatus(fn) {
@eth-p
eth-p / README.md
Created March 9, 2023 08:39
Steam Deck: Always Sudo Scripts

A list of scripts for my Steam Deck that I want to always run as root.

This README describes the files necessary to set up always-sudo scripts. Any other file in this gist is one of the scripts.

/etc/sudoers/x99-always-sudo-scripts

Makes /bin/sudo /root/ALWAYS_SUDO_SCRIPTS/run work for the deck user, without a password prompt.

⚠️ Safety Considerations: ⚠️
This allows that specific "executable" file (bash script) to be run as root without a password prompt.

@eth-p
eth-p / README.md
Last active December 13, 2022 23:16
Code-Server Systemd Units + Pacman Hooks

Code-Server Setup

  • Uses unix socket for code-server
  • Host code-server using nginx (via unix socket) for SSL termination and virtual hosts.
  • Automatically restart code-server when updated with pacman
  • Automatically start code-server as specified user (using systemd)
  • Automatically fix socket permissions so nginx can read/write to unix socket. (using systemd)
@eth-p
eth-p / instagram-direct-as-pwa.user.js
Last active October 11, 2022 04:12
A userscript to use Instagram Direct messages as a PWA.
// ==UserScript==
// @name Instagram Direct as PWA
// @namespace http://tampermonkey.net/
// @version 0.2.1
// @description Create a Chrome "as window" shortcut to use Instagram DMs as a PWA.
// @author eth-p
// @match https://www.instagram.com/direct/*
// @match https://www.instagram.com/?utm_source=pwa_homescreen
// @icon https://www.google.com/s2/favicons?sz=64&domain=instagram.com
// @grant none
// ==UserScript==
// @name Theme Color Sync for Google Calendar PWA
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Changes the window title to be the same color as the app background. Mostly useful for Dark Reader.
// @author eth-p
// @match https://calendar.google.com/*
// @icon https://calendar.google.com/googlecalendar/images/favicons_2020q4/calendar_31_256.ico
// @updateURL https://gist.github.com/eth-p/84609809239f320eb634d3e70f757ad1/raw/google-calendar-theme-sync.user.js
// @downloadURL https://gist.github.com/eth-p/84609809239f320eb634d3e70f757ad1/raw/google-calendar-theme-sync.user.js
@eth-p
eth-p / guide.md
Last active March 27, 2022 18:43
Linux Desktop in Docker

Linux Desktop in Docker

This is my experiment to run Arch in a Docker container on my UnRAID server.

Last Updated: 2022-03-27

Why?

  • VMs are a waste of memory.
  • VMs are a waste of processor usage.
  • VMs have terrible I/O speed.
@eth-p
eth-p / guide.md
Last active April 1, 2022 22:59
How to quickly set up stuff from a GPG master key.
@eth-p
eth-p / fuck-off-autoplay.user.js
Last active January 15, 2021 02:35
A quick gist to prevent websites from automatically playing videos.
// ==UserScript==
// @name Fuck Off Autoplay
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Videos with audio shouldn't be allowed to play without a user gesture.
// @author eth-p
// @match http://*/*
// @match https://*/*
// @grant none
// @downloadURL https://gitcdn.xyz/cdn/eth-p/dc1745cd0b377e17c72d02c92d01ea3a/raw/fuck-off-autoplay.user.js
@eth-p
eth-p / README.md
Last active March 2, 2020 19:45
A script to rebrand "Google Play Music Desktop Player" to "YouTube Music"

gpmdp-to-ydp

This is a simple shell script that rebrands Google Play Music Desktop Player to "YouTube Music".

The following changes are made:

  • The application is renamed.
  • The application name is changed.
  • The application icon is changed.

Usage:

@eth-p
eth-p / mach-mangle-shim.sh
Created October 17, 2019 23:33
A quick bash script that tries to generate shims to allow Mach-O objects to link to assembly written for ELF objects.
#!/usr/bin/env bash
export CLANG_FORCE_COLOR_DIAGNOSTICS=0
SYMBOLS=()
OBJECTS=()
# Check for OSX.
if [[ "$(uname -s)" != "Darwin" ]]; then
printf "\x1B[31m%s\x1B[0m\n" "Mach-O demangle shim isn't needed on non-Darwin platforms."
exit 0
fi