Skip to content

Instantly share code, notes, and snippets.

View wjandrea's full-sized avatar

William Andrea wjandrea

  • Halifax, NS, Canada
  • 02:33 (UTC -03:00)
View GitHub Profile
@wjandrea
wjandrea / setup.ubuntu.solarize.sh
Last active February 20, 2017 19:57 — forked from t-mart/setup.ubuntu.solarize.sh
Simplify hex codes, better palette for gnome-terminal, fix fg color, add darker bg color
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_background" --type bool false
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_colors" --type bool false
# Note about the palette: I am not a graphic designer.
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/palette" --type string "#073642:#D30102:#859900:#B58900:#268BD2:#D33682:#2AA198:#EEE8D5:#002B36:#CB4B16:#4E9A06:#C4A000:#6C71C4:#75507B:#46B46C:#EEE8D5"
# If you want a darker background:
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/background_color" --type string "#001B26"
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/foreground_color" --type string "#93A4A6"
@wjandrea
wjandrea / alert.sh
Last active January 23, 2019 16:48
Ubuntu "alert" alias as function
#!/bin/bash
# You can source this script to get the "alert" function.
function alert {
# Alert after a long running command.
# Use like so: "sleep 2; alert"
local exit=$? # Must go first!
local img=terminal
local msg="$(fc -nl -1 | sed -e 's/^\s\+//; s/\s*[;&|]\s*alert$//')"
@wjandrea
wjandrea / dircolors
Last active May 13, 2026 13:37
My custom dircolors. This is based on the default dircolors in Ubuntu 14.04, I think.
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
#
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Copying and distribution of this file, with or without modification,
# are permitted provided the copyright notice and this notice are preserved.
#
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
@wjandrea
wjandrea / solarized_dark_custom.sh
Last active April 11, 2023 21:24
My custom Solarized Dark theme for Xterm-like terminals. Note that I'm not a graphic designer.
# Solarized was created Ethan Schoonover. https://ethanschoonover.com/solarized/
# Original
base03="002b36"
base02="073642"
base01="586e75"
base00="657b83"
base0="839496"
base1="93a1a1"
base2="eee8d5"
@wjandrea
wjandrea / sieve.py
Last active January 17, 2022 05:47
"sieve" iterative, not recursive, based on https://www.youtube.com/watch?v=5jwV3zxXc8E
def sieve(s):
seen = []
for i in s:
if any(i%n == 0 for n in seen): # If "i" is divisible by any previous numbers
continue
yield i
seen.append(i)
from itertools import count # Don't reinvent the wheel ("nats")
#!/usr/bin/env python3
"""
Use Unicode flag emoji homoglyphs to re-encode UTF-8.
To encode, a string is first encoded as UTF-8, then each byte is
broken down into bits, and each bit is encoded as a flag:
The more well-known country flag in each pair represents 0, and the
less well-known one represents 1. Pairs are cycled through.
There are 8 pairs total, which is the most I could find without repeats.
@wjandrea
wjandrea / Redactle_colour_found_words.css
Last active April 16, 2026 23:40
Redactle colour found words
@-moz-document domain("redactle.net") {
/* Redactle colour found words */
.word:not(.redacted):not(.highlight) {
/* updated April 2026 */
background-color: color-mix(in hsl, var(--color-primary) 40%, transparent);
}
}
@wjandrea
wjandrea / README.md
Last active September 1, 2024 22:17
Tampermonkey script for WordReference French to shorten verb inflection descriptions

Abréger les descriptions des conjugaisons

  • 1, 2, 3 = 1e, 2e, 3e personne
  • sg, pl = singulier, pluriel
  • Temps : si le temps est présent, il n'est pas affiché
  • Mode : si le mode est indicatif, il n'est pas affiché, sauf le présent de l'indicatif

Exemple

raconte

@wjandrea
wjandrea / README.md
Created September 1, 2024 22:23
Tampermonkey script for WordReference French to add Wiktionnaire links

Adds link for headword and links for sub-entries if there are any.

Example

a

Headword:

en espagnol | Conjugaison [FR] | Conjugator [EN] | en contexte | images
Wiktionnaire

@wjandrea
wjandrea / Flag_of_Ukraine_with_Nova_Scotia_crest.svg
Last active May 2, 2026 13:24
The flag of Nova Scotia with the flag of Ukraine replacing Saint Andrew's Cross (also used by the Russian Navy). Нет войне.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.