Skip to content

Instantly share code, notes, and snippets.

Avatar

Nicolas Grégoire ngregoire

View GitHub Profile
@ngregoire
ngregoire / .zshrc
Last active Apr 6, 2020
Efficiently open files from the CLI (using xdg-open and fasd)
View .zshrc
# Add this line to your .bashrc / .zshrc
# The 'o' script (cf below) must be in your $PATH
# 'fasd' (cf https://github.com/clvv/fasd) must be in your $PATH too
alias oo='fasd -a -e o'
# Now use 'oo criteria<TAB>' (iterate through matches) or simply 'oo' (list entries)
# Given that 'fasd' is a requirement, maybe have a look at the 'zz' alias
@ngregoire
ngregoire / dl-twitter-video
Created Apr 6, 2020
Shell script downloading videos embedded in tweets
View dl-twitter-video
#!/bin/bash
# Usage: $0 TWEET_URL <DEST_FILE>
# If the second parameter is omitted, the video is saved to a timestamped file
DLWD_URL=https://www.savetweetvid.com/fr/downloader
TWEET_URL=$1
DEST_FILE=$2
if [ "$TWEET_URL" = "--help" ] || [ "$TWEET_URL" = "-h" ]
@ngregoire
ngregoire / pdf-grep
Last active Nov 9, 2020
Grep through PDF files
View pdf-grep
#!/bin/bash
# Three arguments: ROOT_DIR, PATTERN, OPTIONS
# Search below $ROOT_DIR for PDF files matching $PATTERN
# $OPTIONS is passed to pdfgrep (ex: grep-pdf . 'some words' -h -C5)
# ROOT_DIR
if [ -z "$1" ]; then
echo "! Argument ROOT_DIR is needed!"