Skip to content

Instantly share code, notes, and snippets.

View mcornella's full-sized avatar

Marc Cornellà mcornella

View GitHub Profile
@mcornella
mcornella / Makefile
Last active April 11, 2016 15:14
ZSH wait() syscall test bench for #BashOnUbuntuOnWindows. See https://github.com/Microsoft/BashOnWindows/issues/91#issuecomment-208077623
.PHONY: all test clean
.IGNORE: test
all: wait3_getrusage wait3 waitpid wait
wait3_getrusage: main.c
gcc main.c -D HAVE_WAIT3 -D HAVE_GETRUSAGE -o wait3_getrusage
wait3: main.c
@mcornella
mcornella / build-zsh.txt
Last active June 6, 2016 18:58
This workaround is obsolete, build 14342 solves the issue. Please use that build instead. See https://github.com/Microsoft/BashOnWindows/issues/91#issuecomment-218379746
# THIS HAS BECOME OBSOLETE. IN BUILD 14342 THIS IS SOLVED, PLEASE USE THAT BUILD INSTEAD (OR MORE RECENT ONES)
# See https://github.com/Microsoft/BashOnWindows/issues/91#issuecomment-218379746
# Workaround to build ZSH on #BashOnUbuntuOnWindows.
# See https://github.com/Microsoft/BashOnWindows/issues/91#issuecomment-208077623
# RUN EACH LINE INDEPENDENTLY. THIS IS NOT AN AUTOMATIC BASH SCRIPT.
# Install dependencies
apt-get install -y git-core gcc make autoconf yodl libncursesw5-dev texinfo checkinstall
@mcornella
mcornella / script.js
Last active October 12, 2019 09:41
Allow use of middle click (wheel click) to open quoted tweets
function openquotedtweet(e) {
// Taken from https://stackoverflow.com/a/39165137/5798232
function FindReact(dom) {
let key = Object.keys(dom).find(key=>key.startsWith("__reactInternalInstance$"));
let internalInstance = dom[key];
if (internalInstance === null) return null;
if (internalInstance.return) { // react 16+
return internalInstance._debugOwner
? internalInstance._debugOwner.stateNode
@mcornella
mcornella / dotheshining.zsh
Last active April 14, 2020 14:28
Some stupid shit
#!/usr/bin/env zsh
randcase() {
local line ch z=$RANDOM
while read line; do
if [[ $z -lt 10000 ]]; then
echo ${(U)line}
elif [[ $z -lt 20000 ]]; then
echo ${(L)line}
else
@mcornella
mcornella / bookmark.md
Last active May 27, 2020 08:29
Inbox by Google bookmarklet

Go to inbox.google.com.mcornella.com, or drag this to your bookmarks and change the name to Inbox by Gmail:

data:text/html,<!DOCTYPE html><html lang="en"><head><meta charset="utf8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="description" content="Google Inbox replacement to help with attachment issues."><meta name="theme-color" content="%23FFFFFF"><title>Inbox by Gmail</title><style>@font-face {font-family: "Roboto";font-style: normal;font-weight: 400;font-display: swap;src: local("Roboto"), local("Roboto-Regular"), url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu4mxK.woff2) format("woff2");unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}@font-face {font-family: "Roboto";font-style: normal;font-weight: 700;font-display: swap;src: local("Roboto Bold"), local("Roboto-Bold"), url(https://fonts.gs

Keybase proof

I hereby claim:

  • I am mcornella on github.
  • I am mcornella (https://keybase.io/mcornella) on keybase.
  • I have a public key whose fingerprint is BECE DE26 9494 D435 8731 6473 C411 86BC E5AB 6ED9

To claim this, I am signing this object:

@mcornella
mcornella / .editorconfig
Last active January 5, 2022 08:09
Stats and PR triage for ohmyzsh
root = true
[*]
insert_final_newline = true
charset = utf-8
[*.zsh]
tab_width = 4
indent_size = 4
indent_style = tab
@mcornella
mcornella / .bash_profile
Created January 14, 2022 17:45 — forked from koush/.bash_profile
Put this in your .bash_profile(s) to open VS Code on your local machine when SSH into a remote machine.
# this needs to be on the *remote* machine.
function code() {
if [ -z "$SSH_CLIENT" ]
then
unset -f code
code $@
return
fi
@mcornella
mcornella / index.js
Created March 4, 2022 15:43
Playing with IndexedDB on WhatsApp Web
function openDatabase(...args) {
return new Promise((resolve, reject) => {
const conn = indexedDB.open(...args)
conn.onsuccess = e => resolve({ db: e.target.result })
conn.onerror = e => reject(e.target.result)
})
}
function getContactTransaction({ db }) {
const store = db.transaction(['contact']).objectStore('contact')
@mcornella
mcornella / kubelet-patch.yml
Created October 20, 2022 13:24
kubelet config patch DaemonSet
apiVersion: v1
kind: ConfigMap
metadata:
name: kubelet-entrypoint.sh
labels:
app: kubelet-init
data:
entrypoint.sh: |
#!/bin/sh