Skip to content

Instantly share code, notes, and snippets.

Avatar
📁
copying files

James S. White jameswhite

📁
copying files
View GitHub Profile
View gist:d3986aab8bc66c2abb4be415ddca3af5
== Rules ==
On Infrastructure
-----------------
There is one system, not a collection of systems.
The desired state of the system should be a known quantity.
The "known quantity" must be machine parseable.
The actual state of the system must self-correct to the desired state.
The only authoritative source for the actual state of the system is the system.
The entire system must be deployable using source media and text files.
View gist:ccd2b08395da5f881d43e0fccee28e92
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
View gif-from-tweet.md

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
View gif-from-tweet.md

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
@jameswhite
jameswhite / diskripper.sh
Created Mar 21, 2020 — forked from tacofumi/diskripper.sh
This script rips DVD/Blu-ray using makemkvcon. Use udev to invoke this script to auto-rip when disk is inserted. Some variables such as length of string to trim in order to get the title of movie may vary depending on your environment.
View diskripper.sh
#!/bin/bash
{
echo $(date)
echo ">>>Disk found"
echo ">>>Setting the title..."
title=$(makemkvcon -r info)
title=`echo "$title" | grep "DRV:0\+"`
title=${title:53}
@jameswhite
jameswhite / LICENSE
Created Jan 31, 2020 — forked from brianbruggeman/LICENSE
Convert Viscosity to Open VPN
View LICENSE
Public Domain
@jameswhite
jameswhite / rbvmomi_example1.rb
Created Nov 17, 2019 — forked from rubiojr/rbvmomi_example1.rb
Ruby VMWare VSphere API Example 1 (rbvmomi)
View rbvmomi_example1.rb
require 'rubygems'
require 'rbvmomi'
require 'pp'
require 'alchemist'
hyper = 'thunder03'
vim = RbVmomi::VIM.connect :host => hyper, :user => 'root', :password => 'secret', :insecure => true
#
# get current time
View vcenter_driver.rb
module VCenterDriver
class VirtualMachineFolder
attr_accessor :item, :items
def initialize(item)
@item = item
@items = {}
end
@jameswhite
jameswhite / aws_saml.py
Created Oct 4, 2019 — forked from JoeyG1973/aws_saml.py
aws saml login with session that auto refreshes.
View aws_saml.py
# Took this:
# https://s3.amazonaws.com/awsiammedia/public/sample/SAMLAPICLIADFS/samlapi_formauth_adfs3.py
# converted to boto3 and smooshed it together with this:
# https://gist.github.com/kapilt/ac8e222081f63ba64e93
# which gave birth too this:
import sys
import botocore
import boto3
import requests
@jameswhite
jameswhite / config
Created May 23, 2019
~/.ssh/config
View config
Host planck
User syeargin
ForwardAgent yes
ControlMaster auto
ControlPath /tmp/%r@%h:%p
ProxyCommand ssh root@96.87.216.209 nc %h %p 2> /dev/null
You can’t perform that action at this time.