Skip to content

Instantly share code, notes, and snippets.

View kenmickles's full-sized avatar
🚀

Ken Mickles kenmickles

🚀
View GitHub Profile
@kenmickles
kenmickles / extract-first-frame.sh
Created April 26, 2023 14:23
Extract the first frame from an mp4 with ffmpeg (ChatGPT wrote this for me)
#!/bin/bash
# Check if an input file is provided
if [[ -z "$1" ]]; then
echo "Usage: extract-first-frame.sh input.mp4 [output.jpg] [frame_number]"
exit 1
fi
# Set the input file name
input_file="$1"
@kenmickles
kenmickles / Droplet.scpt
Last active December 29, 2022 07:33
AppleScript to SCP a file to a server and copy the path. Useful for sharing screenshots, etc.
use framework "Foundation"
use scripting additions
property scpTarget : "user@example.com:~/public_html/uploads"
property publicPath : "https://example.com/uploads/"
on open fileList
repeat with thisFile in fileList
set itemPath to the quoted form of the POSIX path of thisFile
do shell script ("scp " & itemPath & " " & scpTarget)
@kenmickles
kenmickles / reclaimWindows10.ps1
Created January 10, 2017 14:55 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1
@kenmickles
kenmickles / spotify_importer.rb
Created April 29, 2016 02:56
Quick and dirty script to import a CSV of songs into a Spotify playlist
require 'httparty'
require 'awesome_print'
require 'enumerator'
USER_ID = "kenmickles"
ACCESS_TOKEN = ""
PLAYLIST_ID = ""
def search_for_track(query)
response = HTTParty.get("https://api.spotify.com/v1/search",
@kenmickles
kenmickles / php_source.conf
Created September 18, 2015 16:40
Apache config to view source of .php files
RewriteEngine On
RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source]
@kenmickles
kenmickles / parse_credits.rb
Last active August 29, 2015 14:08
Format a .CSV export from Google Docs for SUGARfx Rolling Credits
require 'csv'
CSV.read("credits.csv").each_with_index do |line, i|
line.each { |s| s.gsub!("'", "’") unless s.nil? }
if i == 0
puts "[TTL]#{line[0].upcase!}"
elsif line.compact.length > 0
puts "\n" if line[0]
line[1].upcase! if line[1]
@kenmickles
kenmickles / strum.css
Last active August 29, 2015 14:01
CSS snippet for Rachel's blog
/* Option 1: right align the menu on just the blog page */
.blog-sidebar-left #topNav {
width: 1000px;
max-width: 100%;
text-align: center;
margin: 0 auto;
float: none;
}
.blog-sidebar-left #topNav .main-nav {
@kenmickles
kenmickles / download.rb
Last active December 26, 2015 19:49
Download all episodes of a podcast
require 'open-uri'
require 'nokogiri'
url = "http://casbah.podomatic.com/rss2.xml"
open(url) do |rss|
doc = Nokogiri::XML(rss)
doc.xpath("//item").each do |item|
puts `wget -nc "#{item.xpath('enclosure').attr('url')}"`
end
end
@kenmickles
kenmickles / friends.rb
Created October 7, 2013 21:52
Output a Ruby array of Facebook friend IDs
require 'httparty'
facebook_id=[FACEBOOK_ID]
access_token=[ACCESS_TOKEN] # See https://developers.facebook.com/tools/access_token/
puts HTTParty.get("https://graph.facebook.com/#{facebook_id}/friends?access_token=#{access_token}&limit=1000")['data'].map { |f| f['id'] }.inspect
@kenmickles
kenmickles / update-digitial-ocean-dns.sh
Last active April 11, 2022 19:47
Shell script to dynamically update a Digital Ocean DNS record
#!/bin/bash
TOKEN="Get token from https://cloud.digitalocean.com/settings/applications"
DOMAIN=example.com
RECORD_ID=12345
IP=`curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+'`
# to get record id:
# curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" "https://api.digitalocean.com/v2/domains/$DOMAIN/records"