Skip to content

Instantly share code, notes, and snippets.

View mizlan's full-sized avatar
♠️

Michael Lan mizlan

♠️
View GitHub Profile
@mizlan
mizlan / .zshrc
Last active January 13, 2023 13:02
Configuration for seamless transition between light and dark modes. See video https://youtu.be/TSSkUD7vY00.
# CHANGE THE COLORS TO THE RELEVANT ONES FOR YOUR COLORSCHEME
fzf() {
if grep -q dark "$HOME/theme"; then
FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --color=fg:#e0def4,bg:#2a273f,hl:#6e6a86 --color=fg+:#908caa,bg+:#232136,hl+:#908caa --color=info:#9ccfd8,prompt:#f6c177,pointer:#c4a7e7 --color=marker:#ea9a97,spinner:#eb6f92,header:#ea9a97" /opt/homebrew/bin/fzf
else
FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --color=fg:#575279,bg:#fffaf3,hl:#9893a5 --color=fg+:#797593,bg+:#faf4ed,hl+:#797593 --color=info:#56949f,prompt:#56949f,pointer:#907aa9 --color=marker:#d7827e,spinner:#b4637a,header:#d7827e" /opt/homebrew/bin/fzf
fi
}
@mizlan
mizlan / unsubscribe.py
Last active April 25, 2024 03:16
Unsubscribe from a mailing list that implements the one-click List-Unsubscribe RFC 8058, in Python with no external libraries. Takes raw email text as stdin.
'''
automatically trigger a one-click unsubscribe
in an email, according to RFC 8058
'''
from email.header import make_header, decode_header
from email.parser import HeaderParser
import sys
import re
import urllib.request
@mizlan
mizlan / enotes-deblur.js
Created March 19, 2022 04:29
Remove blur on enotes (run in console)
(function() {
'use strict';
//remove class name starting with underscore
for(let i=0; i<10; i++){
document.querySelectorAll("[class^=_]")[0].className="";
}
document.getElementsByClassName('c-cta-section c-cta-section--with-border u-spacing u-align--center u-center-block')[0].style='display:none';
p = document.getElementsByClassName('c-cta-section c-cta-section--with-border u-spacing u-align--center u-center-block');
for(let i = 0; i<p.length; i++){

hacks for macs, in a way

spotlight bug?

  • reindex with sudo mdutil -E /
  • check $HOME/Library/Application Support/com.apple.spotlight/com.apple.spotlight.Shortcuts

prevent ios backups

use strict;
use warnings;
my %sequences;
my %names;
while (<>) {
my ($node_number, $node_name, $seq) = /^(\d+)\.\s+([^:]+):\s*(.+)$/ or next;
printf "appending %s to %s (node %s)\n", $seq, $node_name, $node_number;
$sequences{$node_number} .= $seq;
#!/usr/bin/perl
# parse iqtree .state output
# perl asr_seq.pl foo.state output_file
use strict;
use warnings;
use feature 'say';
my $input_file = $ARGV[0]
#!/usr/bin/env bash
# use like:
# ~/treesitter_neovim_bonker.sh /path/to/tree-sitter/repo /path/to/neovim/repo
# you need to use git-bisect on the tree-sitter repository before doing this
TREE_SITTER_DIR=$1
NEOVIM_DIR=$2

lockdown fixes for MacOS

Notification Center (right panel) not working:

launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist && open /System/Library/CoreServices/NotificationCenter.app/

tried and works, source

set-option -g prefix C-g
unbind-key C-g
bind-key C-g send-prefix
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",*256col*:Tc"
set-option -g status-position bottom
set -g base-index 1