Skip to content

Instantly share code, notes, and snippets.

View lrq3000's full-sized avatar
🎵

Stephen Karl Larroque lrq3000

🎵
View GitHub Profile
@stopyoukid
stopyoukid / diff2html.sh
Last active April 12, 2025 15:23
Script that takes a git diff and outputs an html file in GitHub style
#!/bin/bash
#
# Convert diff output to colorized HTML.
# (C) Mitch Frazier, 2008-08-27
# http://www.linuxjournal.com/content/convert-diff-output-colorized-html
# Modified by stopyoukid
#
html="<html><head><meta charset=\"utf-8\"><title>Pretty Diff</title><style>body {text-align: center;}#wrapper {display: inline-block;margin-top: 1em;min-width: 800px;text-align: left;}h2 {background: #fafafa;background: -moz-linear-gradient(#fafafa, #eaeaea);background: -webkit-linear-gradient(#fafafa, #eaeaea);-ms-filter: \"progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa',endColorstr='#eaeaea')\";border: 1px solid #d8d8d8;border-bottom: 0;color: #555;font: 14px sans-serif;overflow: hidden;padding: 10px 6px;text-shadow: 0 1px 0 white;margin: 0;}.file-diff {border: 1px solid #d8d8d8;margin-bottom: 1em;overflow: auto;padding: 0.5em 0;}.file-diff > div {width: 100%:}pre {margin: 0;font-family: \"Bitstream Vera Sans Mono\", Courier, monospace;font-size: 12px;line-height: 1.4em;text-indent: 0.5em;}.file {color:
@niccokunzmann
niccokunzmann / hanging_threads.py
Last active November 4, 2024 14:48
This module prints all hanging threads that are dead locked. It is for Python 2 and 3. Installable: https://pypi.python.org/pypi/hanging_threads
## The MIT License (MIT)
## ---------------------
##
## Copyright (C) 2014 Nicco Kunzmann
##
## https://gist.github.com/niccokunzmann/6038331
##
## Permission is hereby granted, free of charge, to any person obtaining
## a copy of this software and associated documentation files (the "Software"),
@hofmannsven
hofmannsven / README.md
Last active April 30, 2025 15:25
Git CLI Cheatsheet
@rxaviers
rxaviers / gist:7360908
Last active May 14, 2025 17:39
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@huyng
huyng / .numpy-site.cfg
Last active March 14, 2017 19:36
Place the following in your home directory at ~/.numpy-site.cfg in order to install numpy with openblas support
# Place the following in your home directory at ~/.numpy-site.cfg
# in order to install numpy with openblas support
[openblas]
libraries = openblas
library_dirs = /usr/local/opt/openblas/lib
include_dirs = /usr/local/opt/openblas/include
$files = ls -Recurse | where {!$_.PsIsContainer}
$files | foreach {
$destinationFolder = $_.Directory.FullName -replace "SrcFolderName", "SrcFolderName_converted"
emf2sf.bat $_.FullName --out-dir $destinationFolder
if($LastExitCode -eq 2)
{
copy $_.FullName $destinationFolder
}
}
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active May 13, 2025 09:47
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@syllog1sm
syllog1sm / gist:10343947
Last active September 19, 2024 23:54
A simple Python dependency parser
"""A simple implementation of a greedy transition-based parser. Released under BSD license."""
from os import path
import os
import sys
from collections import defaultdict
import random
import time
import pickle
SHIFT = 0; RIGHT = 1; LEFT = 2;
@arlukin
arlukin / Result.txt
Last active July 28, 2016 08:26
Benchmark of merging dicts in python.
time 1.6452050209 --- d4 = d1.copy(); d4.update(d2), d4.update(d3)
time 1.69228887558 --- d4 = dict(d1, **d2); d4.update(d3)
time 1.78650903702 --- d4 = {}; d4.update(d1); d4.update(d2), d4.update(d3)
time 1.92449307442 --- d4 = {} for d in (d1, d2, d3): d4.update(d)
time 2.00036215782 --- d4 = dict(d1, **d2); d5=dict(d4, **d3)
time 2.04427695274 --- d4 = dict(d1) for d in (d2, d3): d4.update(d)
time 2.68033099174 --- d4 = reduce(lambda x,y: dict(x, **y), (d1, d2, d3))
time 3.72226691246 --- d4 = dict(chain(*[d.iteritems() for d in (d1, d2, d3)]))
time 4.01872420311 --- d4 = dict(d1.items() + d2.items() + d3.items())
time 4.07779598236 --- d4 = dict(chain.from_iterable(d.iteritems() for d in (d1, d2, d3)))
@jakevdp
jakevdp / discrete_cmap.py
Last active January 12, 2025 13:24
Small utility to create a discrete matplotlib colormap
# By Jake VanderPlas
# License: BSD-style
import matplotlib.pyplot as plt
import numpy as np
def discrete_cmap(N, base_cmap=None):
"""Create an N-bin discrete colormap from the specified input map"""