Skip to content

Instantly share code, notes, and snippets.

View ayharano's full-sized avatar

Alexandre Yukio Harano ayharano

View GitHub Profile
### Keybase proof
I hereby claim:
* I am ayharano on github.
* I am ayharano (https://keybase.io/ayharano) on keybase.
* I have a public key whose fingerprint is 20DA DC22 2C3B 1846 C497 0F13 1185 F517 9178 0BCC
To claim this, I am signing this object:
@ayharano
ayharano / favicon.rb
Created September 22, 2017 01:49
Simple ruby script to generate favicon using realfavicongenerator.net non-interactive API. Requires @janko-m/down and @rest-client/rest-client.
#!/usr/bin/env ruby
require 'fileutils'
require 'json'
require 'pathname'
require 'uri'
require 'down'
require 'rest-client'
@ayharano
ayharano / favicon.py
Created September 22, 2017 03:37
Simple python3 script to generate favicon using realfavicongenerator.net non-interactive API. Requires @requests/requests.
#!/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 / captive.sh
Last active October 30, 2017 14:00
Small script used to log a device into a captive portal using mac os' Wi-Fi interface.
#!/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 / onename
Created November 1, 2017 02:26
onename
Verifying that "ayharano.id" is my Blockstack ID. https://onename.com/ayharano
@ayharano
ayharano / gen-pass.py
Created November 16, 2017 01:08
Based on XKCD-style passphrase recipe from https://docs.python.org/3/library/secrets.html#recipes-and-best-practices. Python 3.6+
#!/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
@ayharano
ayharano / grep.py
Created January 3, 2018 12:16
A grep-like copycat to match before and after matched lines, if requested.
#!/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.
@ayharano
ayharano / global_gitignore.bash
Last active December 18, 2018 16:28
Global gitignore populate from github
#!/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 / README.md
Created June 20, 2019 23:36 — forked from joyrexus/README.md
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
#!/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}"