Skip to content

Instantly share code, notes, and snippets.

View fungiboletus's full-sized avatar
🦆
Working

Antoine Pultier fungiboletus

🦆
Working
  • Oslo, Norway
  • 12:27 (UTC +01:00)
View GitHub Profile
@fungiboletus
fungiboletus / sgram.py
Created September 20, 2024 10:21
Febrl's sgram algorithm as a standalone version
# =============================================================================
# AUSTRALIAN NATIONAL UNIVERSITY OPEN SOURCE LICENSE (ANUOS LICENSE)
# VERSION 1.3
#
# The contents of this file are subject to the ANUOS License Version 1.3
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at:
#
# https://sourceforge.net/projects/febrl/
#
@fungiboletus
fungiboletus / hammerspoon-tim-time-tracking.lua
Last active May 3, 2023 14:37
Tim time tracker: Hammerspoon Lua script, to remind you to enable time tracking when you work
function isTimTimeTrackingLive()
local preferencesPath = os.getenv('HOME').."/Library/Containers/neat.software.Tim/Data/Library/Preferences/neat.software.Tim.plist"
local preferences = hs.plist.read(preferencesPath)
local data = hs.json.decode(preferences['Tim_Data'])
local tasks = data['tasks']
-- When Tim has a live session, a record has the same start and end timestamp
for key, task in pairs(tasks) do
records = task['records']
@fungiboletus
fungiboletus / anyconnect.lua
Last active April 9, 2024 14:44
Prefill Cisco AnnyConnect SSO login email using HammerSpoon
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "v", function()
-- Change your email
local email = "[email protected]"
local ciscoName = "Cisco AnyConnect Secure Mobility Client"
local loginWindowName = "login"
if hs.application.launchOrFocus(ciscoName) then
local ciscoApplication = hs.application.get(ciscoName)
local mainWindow = ciscoApplication:mainWindow()
@fungiboletus
fungiboletus / delete_azure_resources.sh
Created February 2, 2022 14:08
Delete Azure Resources
#!/bin/bash
# Don't do that on production I guess
az resource delete --ids $(az resource list | jq ".[].id" -r)
@fungiboletus
fungiboletus / .zshrc
Created January 7, 2022 11:41
Simple .zshrc
unsetopt BEEP
source <(/opt/homebrew/bin/starship init zsh --print-full-init)
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# FZF
export PATH="${PATH:+${PATH}:}/opt/homebrew/opt/fzf/bin"
source "/opt/homebrew/opt/fzf/shell/completion.zsh" 2> /dev/null
source "/opt/homebrew/opt/fzf/shell/key-bindings.zsh"
@fungiboletus
fungiboletus / jwt.js
Created November 9, 2018 13:28
JWT.js
import { readFileSync } from 'fs';
import jose from 'node-jose';
const privateKeyPath = "./private-key.pem";
let privatekeyPem;
try {
privatekeyPem = readFileSync(privateKeyPath);
} catch (error) {
@fungiboletus
fungiboletus / pre-commit.example
Created October 30, 2018 11:45 — forked from ralovely/pre-commit.example
Git pre-commit hook for Ansible Vault
#!/bin/sh
#
# Pre-commit hook that verifies if all files containing 'vault' in the name
# are encrypted.
# If not, commit will fail with an error message
#
# File should be .git/hooks/pre-commit and executable
FILES_PATTERN='.*(vault|secrets).*\.ya?ml$'
REQUIRED='ANSIBLE_VAULT'
@fungiboletus
fungiboletus / JWE.java
Created October 23, 2018 12:23
How to make a RSA JWE JWT JOSE whatever encrypted thing in Java
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
import java.util.Arrays;
import java.util.Date;
@fungiboletus
fungiboletus / _all_docs_to_json_lines.sh
Last active November 4, 2017 09:52
CouchDB _all_docs to JSON Lines
cat input_file.json | sed 's/^M$//' | tail -n "+2" | head -n "-1" | sed 's/},*\r*$//' | sed 's/^.*doc"://' | grep -v '^{"_id":"_design/' > output_file.json
# I like useless cats, it looks cleaner
@fungiboletus
fungiboletus / gist:570dc50a02e44d3a9bf8e559eb5bd05b
Created July 24, 2017 15:55
Visual Studio Code - Vim - BÉPO
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"window.menuBarVisibility": "toggle",
"vim.useCtrlKeys": true,
"vim.handleKeys": {
"<C-a>": false,
"<C-f>": false,