Skip to content

Instantly share code, notes, and snippets.

View alexjpaz's full-sized avatar
🌮

Alexander Paz alexjpaz

🌮
View GitHub Profile
@alexjpaz
alexjpaz / gist:de25c83d69e597e311602ffaa7d16f06
Created June 18, 2020 20:08
ffmpeg with audio with visualization on top of an image with text
#!/bin/bash
ffmpeg \
-y \
-i input.wav \
-i paz.png \
-filter_complex "\
[1:v]scale=-1:480:flags=neighbor,loop=size=2:loop=-1[fg];
[0:a]showcqt=s=1280x720:axis_h=0:sono_h=0:basefreq=27.5:endfreq=1000.0[v];
[fg]drawtext=text='Primitive Rule':fontcolor=white:fontsize=72:font=Bebas Neue:x=(w-text_w)/2:y=(h-text_h)/2[fg];
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
// async /await
const request = async (url) => {
let client = require('http');
if(url.startsWith('https')) {
client = require('https');
}
await new Promise((res, rej) => {
client.get(url, (rsp) => {
@alexjpaz
alexjpaz / JsonLinesTransform.js
Created January 2, 2019 21:14
Node Streams JSON Transformer
var stream = require('stream');
class JsonLinesTransform extends stream.Transform {
_transform(chunk, env, cb) {
if(!this.chunks) {
this.chunks = "";
}
this.chunks += chunk;
@alexjpaz
alexjpaz / gist:f4ae43f60c9f6dc2211a11fc63ac0e41
Created October 23, 2018 21:33
search / replace with awareness of relative module
#!/usr/bin/env python3
import os
files = [
]
for f in files:
cwd = os.getcwd()
path = os.path.dirname(f)
@alexjpaz
alexjpaz / pre-receive
Created September 9, 2017 19:45
git pre-receive hook to run a command with the newest ref on the master branch
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo $oldrev $newrev $ref
echo $PWD
set -x
set -e
mkdir /tmp/$newrev

Keybase proof

I hereby claim:

  • I am alexjpaz on github.
  • I am alexjpaz (https://keybase.io/alexjpaz) on keybase.
  • I have a public key ASAxOtTZfdhIAPKtS6VjFyv0MP_znz8Oh2FA5V8yuPET5go

To claim this, I am signing this object:

@alexjpaz
alexjpaz / archlinux
Last active February 27, 2017 15:57
#!/bin/bash
set -e
set -x
DISK="/dev/sda"
PARTITION="${DISK}1"
echo DISK="$DISK", PARTITION="$PARTITION"
parted -s "$DISK" mklabel msdos
parted -s -a optimal "$DISK" mkpart primary ext4 0% 100%
parted -s "$DISK" set 1 boot on
@alexjpaz
alexjpaz / ks.cfg
Last active February 27, 2017 13:12
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Firewall configuration
firewall --enabled --ssh
# Use CDROM installation media
cdrom
# Network information
network --bootproto=dhcp --device=eth0
@alexjpaz
alexjpaz / tasks
Created August 2, 2016 12:30
tasks bash script template
#!/bin/bash
# change the directory to the script directory
cd ${0%/*}
CMD=${1:-usage}
shift 1
ARGS=$@
usage() {