Skip to content

Instantly share code, notes, and snippets.

Patrick Browne ptbrowne

Block or report user

Report or block ptbrowne

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ptbrowne / jscodeshift.html
Created Mar 14, 2018
JSCodeshift Remark
View jscodeshift.html
<!DOCTYPE html>
<meta charset="utf-8">
@import url(;
@import url(,700,400italic);
@import url(,700,400italic);
ptbrowne /
Last active Jan 21, 2020
Like yarn link but with rsync/nodemon
ptbrowne /
Last active Jul 23, 2019
Simple command cache

If you deal with commands that can take several seconds but always return the same result and you need to transform the result with pipe chain (jq / grep / awk), it can be annoying to wait for those seconds while you incrementally build the command, when you know the result has not changed.

cache.js can help you by caching the result of the command to /tmp and returning the result immediately.



Interactively kills a process

ps aux | fzf | tr -s ' ' | cut -d ' ' -f 2 | xargs kill

ptbrowne /
Last active Nov 1, 2018
Automatically add emojis to your commits

To automatically add emojis to your commits, you can use the commit-msg hook.

$ git init
$ ln -s commit-msg-emoji .git/hooks/commit-msg
ptbrowne /
Last active Jul 13, 2018
from collections import defaultdict
import sys
from copy import deepcopy
def find_common_prefix(word1, word2):
"""Find the longest common prefix between two words"""
i = 0
l1 = len(word1)
l2 = len(word2)
while l1 > i and l2 > i and word1[i] == word2[i]:
ptbrowne /
Created Apr 7, 2014
Source bash environment files in Fish
function source_bash
exec /bin/bash -c "source $argv && exec fish"
ptbrowne /
Last active Feb 26, 2018
make-doc and executes samples
Will render markdown to markdown.
Will execute execbash code blocks and add their output to the code block.
import mistune
import sh
from textwrap import wrap
ptbrowne /
Last active Jan 26, 2018
Retours de ma copine sur Cozy

Retours de ma copine (


Interface claire, pas de boutons, contente de son Cozy.


Apres s'être inscrite pour revenir sur son cozy elle est passée par Sign In et la on lui a demandé une URL et elle savait pas quoi mettre.

ptbrowne /
Created Jan 12, 2018
Predict requires according to variables used
#-*- coding: utf-8 -*-
import fnmatch
import os
def glob(dir, pattern):
for root, dirnames, filenames in os.walk(dir):
for filename in fnmatch.filter(filenames, pattern):
yield os.path.join(root, filename)
You can’t perform that action at this time.