Skip to content

Instantly share code, notes, and snippets.

@Integralist
Integralist / Hash Keys to Symbols.rb
Last active September 2, 2020 08:50
Convert Ruby Hash keys into symbols
hash = { 'foo' => 'bar' }
# Version 1
hash = Hash[hash.map { |k, v| [k.to_sym, v] }]
# Version 2
hash = hash.reduce({}) do |memo, (k, v)|
memo.tap { |m| m[k.to_sym] = v }
end
@dajoho
dajoho / html5.sh
Created March 7, 2013 13:52
Shellscript to create HTML5 <video> MP4/OGV/WEBM/FLV/JPG versions of any video. The size, bitrate, cropping and sharpening can all be defined at the top of the script. Requirements: ffmpeg with libx264/libvpx/libtheora codecs (can be installed via homebrew). And flvtool2 (sudo gem install flvtool2).
#!/bin/bash
FILTERS="-filter:v crop=504:374:6:4,unsharp=5:5:1.0:5:5:0.0";
RESIZE="512x384";
VIDEO_BITRATE="1024k";
AUDIO_BITRATE="64k";
############################################################
for f in "$@"
do
# Licensed under CC BY 3.0 http://creativecommons.org/licenses/by/3.0/
# Derived works must attribute https://gist.github.com/4492300 at the beginning, and the date.
##########################################################
Installing and Configuring SmartOS on Hetzner (with a /29)
##########################################################
# if you find this gist useful, please star it
# thanks to: jamesog, linuxprofessor, ryancnelson for help with routing
@DarthFennec
DarthFennec / XMobarHs.hs
Created January 13, 2013 07:29
A library which can be used to define an .xmobarrc configuration as a haskell object (with all the benefits of defining things in haskell) and export it to a config file to be used by xmobar.
module XMobarHs
( Config (..)
, Position (..)
, Align (..)
, Border (..)
, Command (..)
, Run (..)
, config
, export
) where
@jahewson
jahewson / smartos-on-a-budget.sh
Last active March 9, 2024 07:27
Installing and Configuring SmartOS on a budget server (with a /29)
# Licensed under CC BY 3.0 http://creativecommons.org/licenses/by/3.0/
# Derived works must attribute https://gist.github.com/4492300 at the beginning, and the date.
##################################################################
Installing and Configuring SmartOS on a budget server (with a /29)
##################################################################
# if you find this gist useful, please star it
# please be aware that budget hosting companies usually cut corners somewhere,
@murtaugh
murtaugh / 1. single-line.html
Last active April 21, 2021 16:23
Blockquote patterns for ALA
<figure class="quote">
<blockquote>It is the unofficial force—the Baker Street irregulars.</blockquote>
</figure>
@Wilto
Wilto / blockquote.md
Created December 20, 2012 15:35
Of Blockquotes and Outlines
@benizi
benizi / simpler
Created November 30, 2012 05:26 — forked from justinabrahms/colortest.py
Show how different terminals show bold colors
#!/bin/sh
# Print four lines showing blocks of colors: 0-7 | 0-7bold | 8-15 | 8-15bold
perl -CADS -lwe '
my $block = shift || (chr(0x2588) x 3);
for (["", 0], ["1;", 0], ["", 8], ["1;", 8]) {
my ($bold, $offset) = @$_;
my @range = map $offset + $_, 0..7;
printf "%s %-6s ", $bold ? "bold" : "norm", "$range[0]-$range[-1]";
print map("\e[${bold}38;5;${_}m$block", @range), "\e[0m"
}
@bharrisau
bharrisau / README
Created August 19, 2012 06:14
SMF Manifest to bring up IPv6 on SmartOS
Need to open /usbkey/config and add
admin_v6_ip=xx:xx:xx/xx
admin_v6_gateway=yy:yy:yy
place ipv6 in /opt/custom/smf
place ipv6.xml in /opt/custom/scripts
@rlivsey
rlivsey / 1-helper.js
Created May 3, 2012 19:53 — forked from wagenet/1-helper.js
Ember Handlebars Transform Helper
Ember.HandlebarsTransformView = Ember.View.extend(Ember._Metamorph, {
rawValue: null,
transformFunc: null,
value: function(){
var rawValue = this.get('rawValue'),
transformFunc = this.get('transformFunc');
return transformFunc(rawValue);
}.property('rawValue', 'transformFunc').cacheable(),