Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@istro
istro / tomp4.sh
Last active November 14, 2018 19:43
A shell wrapper for `ffmpeg` command to compress video files to mp4 with h264 codec.
#!/bin/bash/
# Shell wrapper for converting to mp4 with h264 codec with sensible defaults optimized for small file size.
while getopts ":h" opt; do
case $opt in
h)
echo "Usage: 'tomp4 INPUT OUTPUT SCALE_FACTOR'" >&2
echo "Only INPUT is required, just hit enter for default values when prompted." >&2
/// rooms.json
[{
"request": {
"url": "/rooms/:id"
},
"response": {
"data": {
"room": {
"id": 1,
////// EXAMPLE
module.exports = function (server) {
// Create an API namespace, so that the root does not
// have to be repeated for each end point.
server.namespace('/api', function () {
// Return fixture data for '/api/posts/:id'
server.get('/posts/:id', function (req, res) {
var post = {
expected json format:
GET /locations/
{ locations: [
{
'id': 1,
'name': 'foo',
'postal': '123',
@istro
istro / Guardfile
Last active December 25, 2015 15:39
Guardfile.
notification :growl_notify
group :website do
guard 'remote-sync',
source: '1bog/website',
destination: 'public_html/buildtop',
user: 'ivans',
remote_address: '1bogtest.org',
exclude: "/website/init_personal.php",
exclude_from: '',
@istro
istro / gist:6891815
Last active December 25, 2015 00:59
RSA authorization setup instructions

Generate a key pair:

ssh-keygen -t rsa

Press enter when it prompts for file location Enter a passphrase (simple one will do - it's only ever important if your private key (the one on your machine) gets compromised)

This will create a .ssh/ folder with two files - id_rsa and id_rsa.pub in your home directory.

Copy your public key to the server,

@istro
istro / gist:5973617
Last active December 19, 2015 14:59
The challenge: Given an array of integers, find the largest possible sum of consecutive elements of that array. Example: For array [3, -4, 8, -2, -1, 20] the output should be 25, because 8+(-2)+(-1)+20 Live version can be found on codepen - http://codepen.io/istro/pen/qEesB
// To break down the problem for myself better, I like to write some tests.
var test = function(){
// Array contains only negative integers -> result is the single largest element
if(findSum([-14, -5, -22]) != -5 && findSum([-3, -23, -1]) != -1){
alert('First test case fails.');
return false;
}
// Array contains only positive integers -> result is the sum of all elements
if(findSum([1, 2, 3]) != 6 && findSum([5, 6]) != 11){
require 'rspec/core/formatters/progress_formatter'
# Custom RSpec formatter that speaks aloud using the say command, if available.
# Not to be taken too seriously, but fun for annoying your coworkers.
# Usage: bundle exec rspec -r ./say_formatter.rb -f SayFormatter spec
class SayFormatter < RSpec::Core::Formatters::ProgressFormatter
VOICES = %w[Agnes Albert Alex Bad\ News Bahh Bells Boing Bruce Bubbles Cellos
Deranged Fred Good\ News Hysterical Junior Kathy Pipe\ Organ
Princess Ralph Trinoids Vicki Victoria Whisper Zarvox]
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
/*
* Outputs a float representing the iOS version if user is using an iOS browser i.e. iPhone, iPad
* Possible values include:
* 3 - v3.0
* 4.0 - v4.0
* 4.14 - v4.1.4
* false - Not iOS
*/
var iOS = parseFloat(