Skip to content

Instantly share code, notes, and snippets.

@peey
peey / _config.yml
Last active October 19, 2023 12:14
Jekyll plugin for parsing of custom variables in permalinks
# will substitute :author with the variable author in your file (also works with defaults).
permalink: /:author/:slug/
# You need to have this extra permalink_custom_vars array to tell the plugin which substitutions to make
permalink_custom_vars: ['author']
# Note that you don't have to include the supported variables in this list as jekyll takes care of that
# For a complete list of variables jekyll supports, see: https://jekyllrb.com/docs/permalinks/#template-variables
#!/bin/bash
########################################################
#
# ## i3_maximize.sh ##
#
# Implements maximization of a window in i3.
# Swaps the focused container into a new workspace and
# and restores it when run again.
#
@peey
peey / gui_hello_world.py
Created November 2, 2020 16:46 — forked from siwells/Tkinter_hello_world.py
A Python GUI "Hello World" using Tkinter
from tkinter import *
root = Tk()
w = Label(root, text="Hello World")
w.pack()
root.mainloop()
@peey
peey / note.md
Last active August 17, 2020 19:14
Install npm package via github PR

Install npm package from github PR

Locate the branch name associated with the PR

Use this but replace #commit with #branch-name.

Use the username of the PR sender (since branch exists on their repo while unmerged)

// ==UserScript==
// @name Hide Hot Network Questions and Hot Meta Posts
// @namespace http://CHANGE.TO.YOUR.WEBPAGE
// @version 0.2
// @description Hide Hot-Network-Questions in StackExchange sites
// @match *://*.stackexchange.com/*
// @match *://*.stackoverflow.com/*
// @match *://*.superuser.com/*
// @match *://*.serverfault.com/*
// @match *://*.askubuntu.com/*
@peey
peey / add-existing-submodule.fish
Created June 23, 2020 17:13
Add already checked out repo to git as submodule, automatically extract the remote URL from the repo on your local filesystem
#!/usr/bin/env fish
# based on https://stackoverflow.com/a/52127956/1412255
# tbh git should do better. It can record the particular commit and default remote
# instead of displaying "you accidentally added a git repo, did you mean to add a submodule?"
pushd $argv[1]
set url (git remote get-url (git remote))
popd
git submodule add $url $argv[1]
/* don't make right sidebar sticky */
[data-testid=sidebarColumn] > div > div:nth-child(2) {
position: absolute;
}
/* dull out the empty space. Hardcoded colors for white theme. */
[data-testid='primaryColumn'] {
background:#e6ecf0;
}
@peey
peey / write-large-file.js
Last active September 8, 2019 13:42
Writes large files with low memory requirements
var items = 2500000000; // number of lines to write to the file. Currently >20 GB for sequential ints
var buffer_size = 1000000; // amount of items to buffer in memory. Currently ~200 MB for ints
var fs = require('fs')
var buffer = [];
for (var i =0; i < items; i++) {
var data = i; // make it a random integer, or whatever else your heart desires
buffer.push(data);
@peey
peey / examples-of-crossbrowser-incompatibility.md
Last active January 1, 2019 08:03
Browser monculture is bad. And it has real effects