Skip to content

Instantly share code, notes, and snippets.

View borisschapira's full-sized avatar

Boris Schapira borisschapira

View GitHub Profile
@borisschapira
borisschapira / script.js
Last active March 3, 2025 09:38 — forked from spf13/script.js
Download all your Kindle books before Feb 26, 2025
// 1. Log in to your Amazon account
// 2. Go to your Content Library > Books - https://www.amazon.fr/hz/mycd/digital-console/contentlist/booksAll/dateDsc/
// 3. Open your browser's Javascript console
// 4. For each page of books, paste this script into the console
(async function () {
// Close the notification if it appears
function closeNotification() {
const notifClose = document.querySelector("span#notification-close");
if (notifClose) {
@borisschapira
borisschapira / svgToPng.sh
Created November 21, 2024 18:06
Shell script to transform a folder of square-viewbox SVGs in 1024x1024 PNGs, changing the "currentColor" stroke color along the way
#!/bin/bash
# Prerequisites:
# - macOS (for the sed syntax with -i '')
# - inkscape is installed
# - usage: INKSCAPE_PATH=/Applications/Inkscape.app/Contents/MacOS/inkscape ~/svgToPng.sh ./SVG '#7c0033' 'BURGUNDY'
# Function to check if a string is a valid hexadecimal RGB color
is_valid_hex_rgb() {
@borisschapira
borisschapira / filter.svg
Created February 11, 2022 09:56
SVG filter for white drop shadow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@borisschapira
borisschapira / .profile
Last active February 22, 2019 15:56
Open code for workspace if available, file if configured, new workspace if nothing else
# A function to replace the `code` command
#
# With args: does what's intended.
# ```
# > code ~/.bash_history
# ```
#
# With no args, opens the first workspace it founds
# in the current folder, or a new workspace based
# on the current folder if none exists.
@borisschapira
borisschapira / encoding-video.md
Created November 30, 2017 20:53 — forked from glen-cheney/encoding-video.md
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@borisschapira
borisschapira / ffmpegboris
Last active February 9, 2018 18:37
Config ffmpeg pour réencoder mes vidéos (gain de ~10x par rapport à la sortie de mon tél, ~5x par rapport à au Sony N5)
ffmpegboris() {
ffmpeg -i $1 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k -movflags +faststart -vf scale=-2:720,format=yuv420p $1.optimized.mp4
}
ffmpegborisall () {
for i in *.(AVI|MP4|MOV|mov|mp4); do
if [[ ${i} != *"optimized"* ]];then
ffmpegboris $i;
fi
done
@borisschapira
borisschapira / functions.php
Created March 15, 2017 16:47
Displaying current branch in Wordpress Admin Area
/**
* Get the git branch
* @return mixed Either the branch name or the HEAD content or a boolean false
*/
function get_current_git_commit() {
if ( $hash = file_get_contents( get_home_path().'.git/HEAD' ) ) {
preg_match('/ref: refs\/heads\/(.*)/', $hash, $matches, PREG_OFFSET_CAPTURE);
if(count($matches)>=2) {
return $matches[1][0];
} else {
{
// Police à ligature
"editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": true,
// Taille maximum des lignes et
// affichage des espaces
"editor.wrappingColumn": 80,
"editor.wordWrap": true,
"editor.renderWhitespace": "boundary",
@borisschapira
borisschapira / style.sass
Last active April 11, 2018 09:38
Professional CSS for Markdown Here
$main:#066a81;
$grey:rgb(245, 245, 245);
$text-color: #000;
$background: rgb(245,245,245);
$fontStack: arial, helvetica, sans-serif;
$codeFontStack: Consolas, Inconsolata, Courier, monospace;
/*
* NOTE:
@borisschapira
borisschapira / amp.bookmark.min.js
Last active June 22, 2018 08:48
AMP Bookmarket : go to the AMP version of the current page.
javascript:(function(){var ampCol = document.querySelectorAll('link[rel="amphtml"');if(ampCol){location.href=ampCol[0].href;}})();