Skip to content

Instantly share code, notes, and snippets.

View timonus's full-sized avatar

Tim Johnsen timonus

View GitHub Profile
#!/bin/bash
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i "$1" -r 24 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > "$1".gif
rm out-static*.png
else
ffmpeg -i "$1" -s 600x400 -pix_fmt rgb24 -r 24 -f gif - | gifsicle --optimize=3 --delay=3 > "$1".gif
fi
@evanlong
evanlong / .osx
Created July 29, 2012 00:14
OS X for Hackers
# ~/.osx — http://mths.be/osx
###############################################################################
# General UI/UX #
###############################################################################
# Set computer name (as done via System Preferences → Sharing)
scutil --set ComputerName "MathBook Pro"
scutil --set HostName "MathBook Pro"
scutil --set LocalHostName "MathBook-Pro"
Note that like all analogies, this is not a perfect one. I find it helps me think about it though. Also, don't try to draw conclusions about performance from this analogy :)
-[NSUserDefaults setObject:forKey:] is like...
<edit file to add key and value>
git add file
git commit
dispatch_after(some time, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[NSUserDefaults standardUserDefaults] synchronize]
});
// Compile run with:
// cc piper.c -o piper ; ./piper
// From Season 3 Episode 1 of HBO's Silicon Valley
#include <stdio.h>
#include <stdlib.h>
void _ctx_iface(__int128_t s, int i)
{
@raphaelschaad
raphaelschaad / RSPlayPauseButton.h
Last active July 25, 2016 21:44
Edit: this Gist has now a proper repo and even a CocoaPod: https://github.com/raphaelschaad/RSPlayPauseButton
//
// RSPlayPauseButton.h
//
// Created by Raphael Schaad on 2014-03-22.
// This is free and unencumbered software released into the public domain.
//
#import <UIKit/UIKit.h>
@evanlong
evanlong / LWHangDetector.h
Last active November 17, 2016 16:06
Simple Hang Detection
/**
Copyright (C) 2011 Evan Long
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
@kentbrew
kentbrew / pinterest_meta.md
Created June 5, 2017 22:12
Pinterest's META Namespace

Just like Facebook and Twitter, Pinterest has its own namespace. Go like this:

<meta property="pin:url" content="https://yourpage.com/pinit/test/pinterest_meta.html" />
<meta property="pin:description" content="This pin was generated by the Pinterest meta." />
<meta property="pin:media" content="http://cdn.yourpage.com/your_image_here.jpg" />

... and your preferred image (which need not actually appear on the page) will show at the top of the grid when someone uses Pinterest's mobile device, browser extension, or Any Image Save button.

@paulofierro
paulofierro / ats-s3.txt
Created October 1, 2015 20:25
Apple Transport Security Diagnostics on Amazon S3
You can test ATS diagnositcs in Mac OS X El Capitan by running:
nscurl --ats-diagnostics -v https://s3.amazonaws.com
Here is the log:
================================================================================
Starting ATS Diagnostics
Configuring ATS Info.plist keys and displaying the result of HTTPS loads to https://s3.amazonaws.com.
@0xced
0xced / Emoji-iOS-10.0-14A5322e.json
Created August 8, 2016 22:38
Emoji from iOS beta 4 (14A5322e)
{
"People" : [
{
"Symbol" : "😀",
"Name" : "GRINNING FACE"
},
{
"Symbol" : "😬",
"Name" : "GRIMACING FACE"
},
sudo cp -r /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/12.0\ \(16A5318d\) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/