Skip to content

Instantly share code, notes, and snippets.

@kurrik
kurrik / input-time.js
Created October 8, 2012 17:12
Insert a time input into Twitter
document.body.appendChild(function() { var e = document.createElement("input"); e.type="time"; e.style.position="absolute"; e.style.top="0px"; e.style.left="0px"; e.style.zIndex="1000"; return e; }())
@kurrik
kurrik / ffmpeg_convert.sh
Last active January 8, 2019 15:48
ffmpeg recipes
# Convert `mymovie.mp4` to `mymovie.mov`, re-encoding.
ffmpeg -i mymovie.mp4 mymovie.mov
# Change `mymovie.mov` to `mymovie.mp4`, without re-encoding.
ffmpeg -i mymovie.mov -vcodec copy -acodec copy mymovie.mp4
# Change `mymovie.mp4` to `mymovie-nosound.mp4`, dropping audio and re-encoding video to H.264 high quality
ffmpeg -i mymovie.mp4 -c:v libx264 -profile:v high -an mymovie-nosound.mp4
# Resize `mymovie.mp4` to `mymovie-480.mp4`, setting width to 480px and keeping aspect ratio
@kurrik
kurrik / twitter_ssl.rb
Created March 21, 2013 17:02
Demonstrating that Ruby sends invalid HTTPS requests unless use_ssl is explicitly set
require 'net/https'
# Returns {"errors":[{"message":"Bad Authentication data","code":215}]}
# Issues a HTTPS request to: GET https://api.twitter.com/1.1/users/show.json?user_id=33978
# Prints: Explicit SSL: #<Net::HTTPBadRequest:0x10b65f188>
uri = URI.parse("https://api.twitter.com/1.1/users/show.json?user_id=33978")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
request = Net::HTTP::Get.new(uri.request_uri)
@kurrik
kurrik / .tmux.conf
Last active April 18, 2020 03:23
Remote .tmux.conf (handles nesting, different colors)
# Install:
# curl https://gist.githubusercontent.com/kurrik/ec0a83cf568b9c16b8ce08dd407adf65/raw/.tmux.conf > ~/.tmux.conf
#
# Instructions:
# When nested, use an extra `ctrl-b` to issue commands to the nested session.
# E.g. to go to the next window `ctrl-b ctrl-b ctrl-n`
# Colors
set -g default-terminal "xterm-256color"
@kurrik
kurrik / about.md
Created August 9, 2011 15:11 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@kurrik
kurrik / manifest.json
Created March 31, 2014 17:13
Including embedded Tweets in a Google Chrome extension
{
"manifest_version": 2,
"name": "crx-widgetsjs",
"description": "Load Twitter's widgets.js in a Chrome extension",
"version": "1.0",
"permissions": [
],
"browser_action": {
@kurrik
kurrik / AppsScriptEmailFormResponsesWithImages.gs
Last active January 23, 2021 20:17
AppsScript for emailing form responses with images
function onFormSubmit(e) {
const itemResponses = e.response.getItemResponses();
const formData = itemResponses.map((ir) => {
const i = ir.getItem();
return {
'question': i.getTitle(),
'response': getResponse(ir),
};
});
const emailData = {
@kurrik
kurrik / stripe-cli.sh
Created August 12, 2021 17:03
Stripe CLI tricks
# Print the currently configured account's test mode API key (in case you need to pass to a script / curl):
stripe config --list | awk '$1=="test_mode_api_key"{gsub(/"/, "", $3);print $3}'
@kurrik
kurrik / GoogleForms-CustomDestination.gs
Last active August 24, 2021 00:56
Sending nicely-formatted change emails from Google Apps Forms
/**
* This script sends an email in response to form submissions.
* It formats metadata specified in the form and may be configured
* to send to different audiences depending on which options are
* chosen. The email is nicely formatted, suitable for ingestion
* into Slack.
**/
/** CHANGE THE FOLLOWING TO MATCH YOUR FORM **/
@kurrik
kurrik / elgato-key-light-smartthings-device-handler.groovy
Last active September 27, 2021 18:54 — forked from cramforce/elgato-key-light-smartthings-device-handler.groovy
A SmartThings Device Handler for Elgato Key Light
/**
* Copyright 2020 Malte Ubl
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License