Skip to content

Instantly share code, notes, and snippets.

View Naereen's full-sized avatar
📝
Coder in long holidays - full time teacher

Lilian Besson Naereen

📝
Coder in long holidays - full time teacher
View GitHub Profile
@Naereen
Naereen / minted.py
Created April 1, 2023 10:49 — forked from jepio/minted.py
Pandoc filter to use minted for syntax highlighting
#!/usr/bin/env python3
'''
Filter to wrap Pandoc's CodeBlocks into minted blocks when using latex.
Pandoc's `fence_code_attributes` can be used to provide:
- the language (first class)
- minted's argumentless options (following classes)
- minted's options with arguments (attributes)
'''
@GabriOliv
GabriOliv / custom_logo_shields.md
Last active March 13, 2021 20:09
Tips and Links of Web-apps to Transform a .SVG to Shield for README.md; Some Examples of Shield with custom Icons

Shields with Custom Icons

Web-apps and Tips to Transform a .SVG to Shields; and some Examples of Shields with Custom Icons


Steps:

  1. Download the SVG image logo
@m-radzikowski
m-radzikowski / script-template.sh
Last active May 4, 2024 04:13
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@gullyn
gullyn / flappy.html
Last active May 4, 2024 15:35
Flappy bird in 205 bytes (improved!)
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>

Keybase proof

I hereby claim:

  • I am naereen on github.
  • I am naereen (https://keybase.io/naereen) on keybase.
  • I have a public key ASB0qooyut1iVIMM35DaR2wUiYQ-q4jMDNUPL_LGM_0DTwo

To claim this, I am signing this object:

@benhoyt
benhoyt / edit_distance.py
Created May 8, 2018 14:06
Calculate edit distance with simple (memoized) recursive algorithm
def distance(s, t, cache=None):
"""Return minimum edit distance between s and t, where an edit
is a character substitution, deletion, or addition.
"""
if not s:
return len(t)
if not t:
return len(s)
if cache is None:
@Naereen
Naereen / corner-ribbon.css
Created March 29, 2018 10:43
Ruban pour promouvoir un livre
@import url('//fonts.googleapis.com/css?family=Tangerine');
/* The ribbons */
.corner-ribbon {
font-family: "Tangerine",sans-serif;
width: 400px;
background: #e43;
position: absolute;
top: 50px;
left: -100px;
@katrinleinweber
katrinleinweber / clone-rm-dx-from-doi.sh
Last active September 17, 2018 08:26
Semi-automatically update dx.doi.org links on GitHub to https://doi.org
#!/usr/bin/env bash
# Semi-automatically update dx.doi.org links on GitHub to https://doi.org.
#
# Usage:
# 1. Copy this gist into a local folder of yours (e.g. ~/forks/).
# 2. Make it executable with `chmod +x ~/path/to/clone-rm-dx.sh`
# 3. Install the gfork Node.js package and its dependencies.
# 4. Find target repos on https://github.com/search?o=desc&q=dx.doi&s=indexed&type=Code&utf8=%E2%9C%93
# 5. Insepct the code: can `dx.doi.org` be savely updated? Inspect tests,
@gnestor
gnestor / github-py.ipynb
Last active February 9, 2022 00:25
A notebook for generating a Jupyter Notebook release changelog and credits
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yawaramin
yawaramin / sig
Last active June 12, 2022 05:03
Bourne Shell script to print out Merlin's inferred signature of an OCaml file (module)
#!/usr/bin/env sh
# Works with merlin version 2.5.4. Using protocol described at
# https://github.com/ocaml/merlin/blob/master/doc/dev/OLD-PROTOCOL.md#type-checking
usage ()
{
echo Usage: either of the following will work:
echo
echo ' sig module.ml'