Skip to content

Instantly share code, notes, and snippets.

View sbibauw's full-sized avatar

Serge Bibauw sbibauw

View GitHub Profile
@simonmichael
simonmichael / paypaljson
Created June 22, 2021 21:21
updated scripts for downloading paypal transactions for hledger
#!/bin/bash
# Download recent transaction history from Paypal as JSON,
# and print on stdout.
#
# Requirements: a Paypal developer account, curl, jq (just for pretty-printing)
#
# brew install jq
#
# Limitations:
# - sees only the last 30 days of history
@sbibauw
sbibauw / rename_pdf_doi.sh
Last active May 27, 2021 23:53
Rename PDF as AuthorYear.pdf from Crossref DOI data
# Used as an embedded shell script in Hazel for files where a DOI is available
#
# Depedencies:
# - pdfgrep
# - curl
# - jq
newname=$(pdfgrep -oPm 1 --page-range=1-2 '\b10.\d{4,9}/[-._;()/:A-Za-z0-9]+\b' $1 |
xargs -I{} curl -sLH "Accept: application/json" http://dx.doi.org/{} |
jq '.author[0].family, .issued."date-parts"[0][0]' |
@simonmichael
simonmichael / paypalcsv
Last active June 16, 2021 04:03
paypalcsv - download transactions CSV from Paypal's API
#!/bin/bash
# Download last 30 days of transaction history from Paypal as CSV.
# brew install jsonpp jq
# npm install -g json2csv
# credentials from an API app created in https://developer.paypal.com
CLIENT_ID=
SECRET=
@ipudu
ipudu / rename_pdf.py
Created October 4, 2019 01:51
Rename an academic article pdf with human readable format
import sys
import requests
import PyPDF2
import requests
import os
crossref = 'http://api.crossref.org/'
def rename(pdf):
"""Rename an academic article pdf file with human readable format
@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active January 21, 2024 16:28
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@mp4096
mp4096 / ppt2pdf.ps1
Created April 28, 2016 10:56
Batch convert PowerPoint files to PDF
# Batch convert all .ppt/.pptx files encountered in folder and all its subfolders
# The produced PDF files are stored in the invocation folder
#
# Adapted from http://stackoverflow.com/questions/16534292/basic-powershell-batch-convert-word-docx-to-pdf
# Thanks to MFT, takabanana, ComFreek
#
# If PowerShell exits with an error, check if unsigned scripts are allowed in your system.
# You can allow them by calling PowerShell as an Administrator and typing
# ```
# Set-ExecutionPolicy Unrestricted
@jamesktan
jamesktan / Shell Commands ePub
Last active April 18, 2024 12:28
Unzipping & Zipping ePub from Command Line
// To unzip the epub, move the ePub to a folder, cd to it then simply:
unzip MyEbook.epub
// To zip up an epub:
1. zip -X MyNewEbook.epub mimetype
2. zip -rg MyNewEbook.epub META-INF -x \*.DS_Store
3. zip -rg MyNewEbook.epub OEBPS -x \*.DS_Store
Some explanations necessary here. We start each line with two flags:
@brechtm
brechtm / argenta_csv_to_ofx.py
Created April 13, 2014 20:00
Converts a Argenta bank statements (CSV) to Open Financial Exchange (OFX) format, for import into manager.io
#!/bin/env python
import argparse
import csv
from xml.etree import ElementTree as ET
OFX_DECLARATION = [('OFXHEADER', 200),
('VERSION', 211),
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 14, 2024 18:00
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx