Skip to content

Instantly share code, notes, and snippets.

@jtanguy
jtanguy / git-jira.sh
Created January 16, 2023 13:09
Create a branch name from assigned jira tickets
#!/usr/bin/env bash
#
# External programs: jq fzf elinks curl sed awk cut
JIRA_URL="https://<jira>.atlassian.net"
USER_EMAIL="<user-email>"
USER_KEY="<api-key>"
JIRA_QUERY='resolution=unresolved and statusCategory = "In Progress" and assignee = currentUser() order by updated desc'
@jtanguy
jtanguy / dependency-graph-plugin.js
Created June 6, 2018 19:20
Webpack plugin to generate the dependency graph
const path = require('path');
class DependencyGraphPlugin {
apply(compiler) {
compiler.hooks.emit.tap("DependencyGraphPlugin", (compilation) => {
let deps = [];
compilation.modules.forEach(m => {
// console.log(m)
const file = path.relative('', m.resource)
@jtanguy
jtanguy / URIParser.hs
Created January 22, 2016 11:02
Simple query parameter parser
{-|
Module : URIParser
Copyright : (c) 2016 Julien Tanguy
License : BSD3
Maintainer : julien.tanguy@jhome.fr
Stability : experimental
Portability : portable
Simple URI parser. Parses query string parameters into a map

Keybase proof

I hereby claim:

  • I am jtanguy on github.
  • I am jtanguy (https://keybase.io/jtanguy) on keybase.
  • I have a public key whose fingerprint is D306 58EB 6067 735A A204 7239 70A2 176E 39C0 92F8

To claim this, I am signing this object:

@jtanguy
jtanguy / hakyll-redirects.hs
Created January 13, 2014 14:32
Redirects within hakyll
match "redirects.txt" $ do
route $ constRoute ".htaccess"
compile $ makeItem "" >>=
loadAndApplyTemplate "templates-htaccess" myCtx
where
myCtx = metadataField `mappend`
defaultContext
@jtanguy
jtanguy / .jq
Last active December 18, 2015 02:39
Semitan opendata jq helpers
# Get the nearest stops for a given line
# Usage: curl -s https://open.tan.fr/ewp/arrets.json/47,24943/-1,54812 | jq 'nearestStops("2")'
def nearestStops(l):map(select(.ligne[].numLigne == l))| map({libelle, codeLieu, distance});
# Get the next two stops for a given stop
# Requires jq version >= 1.3
# Usage: curl -s https://open.tan.fr/ewp/tempattente.json/ECSU | jq 'nextStops("2")'
def nextStops(l): map(select(.ligne.numLigne == l)) | [{(.[].terminus): [.[].temps][0:3]}] | unique;
@jtanguy
jtanguy / dabblet.css
Created January 31, 2013 12:53
Time display for blog post
/**
* Time display for blog post
*/
@import url(http://fonts.googleapis.com/css?family=Syncopate);
.date {
font-family: "Syncopate", sans-serif;
text-align: center;
vertical-align: 50%;
border: 1px solid black;
width: 5em;
#!/usr/bin/env ruby
# Aside from removing Ruby on Rails specific code this is taken verbatim from
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome
# - Ryan Florence (http://ryanflorence.com)
#
# Install this hook to a remote repository with a working tree, when you push
# to it, this hook will reset the head so the files are updated
if ENV['GIT_DIR'] == '.'