Skip to content

Instantly share code, notes, and snippets.

@SamSamskies
SamSamskies / html5-boilerplate.html
Created August 31, 2013 04:40
Simplest HTML5 Boilerplate template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Blank HTML 5 Template</title>
</head>
<body>
</body>
</html>
@revett
revett / README.md
Last active November 7, 2016 11:36
Tutum Zero Downtime Re-deploy

Tutum Zero Downtime Re-deploy

cats.jpg

I tweeted Tutum last night asking if they're looking at implementing zero downtime re-deploys for a given service. Slightly surprised by their response as it seems like a critical feature if you want to use the service for a production environment.

"not a top priority, but by Spring :)"

As Tutum currently doesn't support graceful termination of containers within a service, I was experiencing a 5-10 second window of 503 errors, so decided to use the following hack (code below) until the feature is officially implemented.

@lenguyenthedat
lenguyenthedat / Countries.csv
Created April 20, 2015 07:09
Country - Continent codes and names
We can make this file beautiful and searchable if this error is corrected: Any value after quoted field isn't allowed in line 1.
"continent_code", "country_code","continent_name","country_name","country_iso3","country_number","country_full_name
"AS","AF","Asia","Afghanistan","AFG","004","Islamic Republic of Afghanistan"
"EU","AX","Europe","Åland Islands","ALA","248","Åland Islands"
"EU","AL","Europe","Albania","ALB","008","Republic of Albania"
"AF","DZ","Africa","Algeria","DZA","012","People"s Democratic Republic of Algeria"
"OC","AS","Oceania","American Samoa","ASM","016","American Samoa"
"EU","AD","Europe","Andorra","AND","020","Principality of Andorra"
"AF","AO","Africa","Angola","AGO","024","Republic of Angola"
"NA","AI","North America","Anguilla","AIA","660","Anguilla"
"AN","AQ","Antarctica","Antarctica","ATA","010","Antarctica the territory South of 60 deg S"
# -*- coding: utf-8 -*-
"""
Created on Tue May 17 23:05:35 2016
@author: Oyc
"""
import os
import requests as req
from bs4 import BeautifulSoup as bs
@ddennedy
ddennedy / dash-avc264 command lines
Last active July 27, 2022 03:44
Use ffmpeg and mp4box to prepare DASH-AVC/264 v1.0 VoD
See my DASH-IF presentation from October, 2014:
https://s3.amazonaws.com/misc.meltymedia/dash-if-reveal/index.html#/
1. encode multiple bitrates with keyframe alignment:
ffmpeg -i ~/Movies/5D2_Portrait.MOV -s 1280x720 -c:v libx264 -b:v 1450k -bf 2 \
-g 90 -sc_threshold 0 -c:a aac -strict experimental -b:a 96k -ar 32000 out.mp4
My input was 30 fps = 3000 ms. If it were 29.97, then a GOP size of 90 frames will yield a base segment
size of 3003 milliseconds. You can make the segment size some multiple of this, e.g.: 6006, 9009, 12012.
@TheDistantSea
TheDistantSea / version_compare.js
Created December 18, 2013 12:19
Function to compare two version strings (e.g. "1.6.1" is smaller than "1.7"). Developed in order to answer http://stackoverflow.com/a/6832721/50079.
/**
* Compares two software version numbers (e.g. "1.7.1" or "1.2b").
*
* This function was born in http://stackoverflow.com/a/6832721.
*
* @param {string} v1 The first version to be compared.
* @param {string} v2 The second version to be compared.
* @param {object} [options] Optional flags that affect comparison behavior:
* <ul>
* <li>
@seventhmoon
seventhmoon / TvDeviceTypes.kt
Last active March 31, 2023 14:22
TvDeviceTypes
import android.annotation.SuppressLint
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import androidx.annotation.IntDef
//Make sure you have the following declared in Manifest when running on Android 11+
//<queries>
//<package android:name="com.google.android.tvlauncher" />
//<package android:name="com.google.android.leanbacklauncher" />
@John07
John07 / HLS_dvr.sh
Last active June 10, 2023 10:40
A small script to make recording http live streams (HLS, those streams that work on iOS devices) nicer on a Mac. Script records the stream for a defined period of time and sends the user notifications if anything goes wrong and once it's done.
# required: ffmpeg (e.g. from homebrew), terminal-notifier from https://github.com/alloy/terminal-notifier
# you can schedule this with launchd to run e.g. weekly
# Specify in seconds how long the script should record (default here is 1 hour).
seconds=3600
# Date format for the recording file name
DATE=`date "+%d-%m-%y_%H-%M"`
# start ffmpeg recording
@willprice
willprice / .travis.yml
Last active August 15, 2023 17:12
How to set up TravisCI for projects that push back to github
# Ruby is our language as asciidoctor is a ruby gem.
lang: ruby
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name="viewport" />
<link rel="icon" href="data:,">
<title>String art</title>
<script type="text/javascript" src="jquery.min.js"></script>
<style>
html, body {