Skip to content

Instantly share code, notes, and snippets.

View allyunion's full-sized avatar

Jason Lee allyunion

  • Los Angeles, CA
View GitHub Profile
@allyunion
allyunion / convert-webp-to-gifs.py
Created March 7, 2024 09:46
Convert WEBP to GIFs
#!/usr/bin/env python3
import os
from PIL import Image
for root, dirs, files in os.walk("."):
for filename in files:
if '.webp' in filename:
new_filename = filename.replace('.webp', '.gif')
im = Image.open(filename)
im.info.pop('background', None)
@allyunion
allyunion / gist:89c4b74bde9133c297e7386004671650
Created November 1, 2023 19:20
Split up video into 15 second segments
ffmpeg -i input.mp4 -force_key_frames 'expr:gte(t,n_forced)' -f segment -segment_time 15 -reset_timestamps 1 -map 0 -segment_format_options movflags=+faststart output_%03d.mp4
# From:
# Original command:
ffmpeg -i input.mp4 -force_key_frames expr:gte(t,n_forced*600) -f segment -segment_time 600 -reset_timestamps 1 -map 0 -segment_format_options movflags=+faststart output_%03d.mp4
# https://unix.stackexchange.com/questions/1670/how-can-i-use-ffmpeg-to-split-mpeg-video-into-10-minute-chunks
# To split the video more accurately, you can use the -force_key_frames option to specify keyframes at the desired split points.
#
## -f segment -segment_time 600 sets the segment length
## gte(t, n_forced*600): This is the expression itself, where:
#!/bin/bash
INTERFACE="wlan0"
GATEWAY=$(ip r | grep default | awk '{print $3}')
TEST_NETWORK=$(ping -c 1 ${GATEWAY} &> /dev/null; echo $?)
if [[ $test_network -ne 0 ]]
then
ifdown ${INTERFACE}
sleep 10
Channels:
36
40
44
48
52
56
60
64
100
In [1]: import requests
In [2]: url = 'https://releases.hashicorp.com/terraform/'
In [3]: page = requests.get(url)
In [6]: from bs4 import BeautifulSoup as bs
In [7]: soup = bs(page.text, 'html.parser')
@allyunion
allyunion / add_jenkins_slave.sh
Created October 29, 2018 23:06
Add a Jenkins Slave node
SLAVE_NAME=$1
CREDENTIALS_ID=<INSERT_CREDENTIALS_HERE>
# USERNAME & PASSWORD is read from Jenkins credentials
cat <<EOF | java -jar /var/lib/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ create-node ${SLAVE_NAME} --username $USERNAME --password $PASSWORD
<slave>
<name>${SLAVE_NAME}</name>
<description>A Jenkins Slave node</description>
<remoteFS>/home/jenkins</remoteFS>
<numExecutors>5</numExecutors>
<mode>NORMAL</mode>
@allyunion
allyunion / .vimrc
Created October 25, 2017 00:17
The .vimrc I use
syntax on
filetype plugin indent on
set ffs=unix
set backspace=indent,eol,start
set tabstop=2 softtabstop=2 shiftwidth=2 expandtab smarttab
autocmd FileType html setlocal shiftwidth=2 tabstop=2 smarttab
autocmd FileType python setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=4 smarttab
@allyunion
allyunion / PackerAccess.json
Last active August 18, 2017 20:09
The minimum access required for Packer
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PackerAMIAccess",
"Action": [
"ec2:CopyImage",
"ec2:CreateImage",
"ec2:DeregisterImage",
"ec2:DescribeImageAttribute",
@allyunion
allyunion / vbox_server
Created August 5, 2016 23:02
VirtualBox startup script
#!/bin/sh
### BEGIN INIT INFO
# Provides: vbox_server
# Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Starts a VirtualBox instance named 'vbox_server'
### END INIT INFO
@allyunion
allyunion / private.xml
Created February 18, 2016 17:13
private.xml for Karabiner that corrects for PC Styles to include VI
<?xml version="1.0"?>
<root>
<replacementdef>
<replacementname>PC_STYLE_BINDINGS_IGNORE_APPS</replacementname>
<replacementvalue>
VIRTUALMACHINE,
REMOTEDESKTOPCONNECTION,
VNC,
TEAMVIEWER,