Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexandre Harano ayharano

View GitHub Profile
View Changes are coming to pip-B4GQCBBsuNU.pt-BR.vtt
WEBVTT
Kind: captions
Language: pt-BR
00:00:00.000 --> 00:00:02.838
Uma grande mudança chega
a pip em outubro.
00:00:02.938 --> 00:00:07.362
Será um grande alicerce para tornar mais fácil
View cut_resize_normalize.sh
#!/usr/bin/env bash
INPUT_FILE="${1}"
TIME_START="${2}" # expected format HH:MM:SS
TIME_DURATION="${3}" # expected format HH:MM:SS
OUTPUT_FILE="${4}"
BASE="$(basename "${INPUT_FILE}")"
SHM_AUDIO_FILE="/dev/shm/audio_${BASE}"
SHM_VIDEO_FILE="/dev/shm/video_${BASE}"
@ayharano
ayharano / README.md
Created Jun 20, 2019 — forked from joyrexus/README.md
collapsible markdown
View README.md

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@ayharano
ayharano / global_gitignore.bash
Last active Dec 18, 2018
Global gitignore populate from github
View global_gitignore.bash
#!/usr/bin/env bash
URL_PREFIX='https://raw.githubusercontent.com/github/gitignore/master/'
URL_SUFFIX='.gitignore'
GLOBAL_IGNORE=~/.config/git/ignore
mkdir -p "${GLOBAL_IGNORE}" && rmdir "${GLOBAL_IGNORE}"
echo -n > "${GLOBAL_IGNORE}"
pushd /tmp
for IGNORE in {Linux,Windows,macOS,Vim,Emacs,JetBrains,SublimeText,VisualStudioCode,Ansible,VirtualEnv}; do
@ayharano
ayharano / grep.py
Created Jan 3, 2018
A grep-like copycat to match before and after matched lines, if requested.
View grep.py
#!/usr/bin/env python3
"""A `grep`-like copycat to match before and after matched lines.
"""
import re
def grep(pattern, string, before=0, after=0):
"""A grep-like copycat to match before and after matched lines,
if requested.
View gen-pass.py
#!/usr/bin/python3
"""
Based on XKCD-style passphrase recipe from
https://docs.python.org/3/library/secrets.html#recipes-and-best-practices.
"""
import secrets
TRUNCATE = 64
View onename
Verifying that "ayharano.id" is my Blockstack ID. https://onename.com/ayharano
@ayharano
ayharano / captive.sh
Last active Oct 30, 2017
Small script used to log a device into a captive portal using mac os' Wi-Fi interface.
View captive.sh
#!/bin/bash
set -eu
# URL of a website without https
HTTP_URL='pudim.com.br'
SLEEP_SECONDS_AFTER_RESETING_WIFI='30'
# Binaries' full path
WHICH="$(which which)"
CURL="$("${WHICH}" curl)"
@ayharano
ayharano / favicon.py
Created Sep 22, 2017
Simple python3 script to generate favicon using realfavicongenerator.net non-interactive API. Requires @requests/requests.
View favicon.py
#!/usr/bin/env python3
"""Generate favicon using realfavicongenerator.net non-interactive API."""
import json
import os
from pathlib import Path
import shutil
import sys
import tempfile
from urllib.parse import urlparse
@ayharano
ayharano / favicon.rb
Created Sep 22, 2017
Simple ruby script to generate favicon using realfavicongenerator.net non-interactive API. Requires @janko-m/down and @rest-client/rest-client.
View favicon.rb
#!/usr/bin/env ruby
require 'fileutils'
require 'json'
require 'pathname'
require 'uri'
require 'down'
require 'rest-client'