Oct 16 2010
- 04/10/2011 - Updated application.js and application.rb thanks to @rebo's comments
In this article, I will walk through some simple steps to get a [demo app][2] up and running with [Backbone.js][3] and [Sinatra][4] on [Heroku][5].
;;; js-beautify.el -- beautify some js code | |
(defgroup js-beautify nil | |
"Use jsbeautify to beautify some js" | |
:group 'editing) | |
(defcustom js-beautify-args "--jslint-happy --brace-style=end-expand --keep-array-indentation" | |
"Arguments to pass to jsbeautify script" | |
:type '(string) | |
:group 'js-beautify) |
ig.module( | |
'plugins.color-picker' | |
) | |
.requires( | |
) | |
.defines(function(){ | |
/* | |
Initialize object with a default 10 color array fading from | |
White to Red and with a Tri-Color array from Green to Yellow |
class BackTicks | |
def run | |
`pwd` | |
end | |
end | |
describe BackTicks do | |
subject { BackTicks.new } | |
it "should execute run" do |
# process list info | |
select id, user, db, host, command, state, time from INFORMATION_SCHEMA.PROCESSLIST; | |
# ALL Tables in ALL DBs | |
SELECT CONCAT(table_schema, '.', table_name), | |
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows, | |
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA, | |
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx, | |
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size, | |
ROUND(index_length / data_length, 2) idxfrac |
For a project I am on I need to use a key-value store to converts file-paths to fixnum IDs. The dataset will typically be in the range of 100 000 to 1 000 000. These tests use 305 000 file paths to fixnum IDs.
The Different Key-Value stores tested are:
Daybreak: "Daybreak is a simple and very fast key value store for ruby" GDBM: GNU dbm. "a simple database engine for storing key-value pairs on disk." DBM: "The DBM class provides a wrapper to a Unix-style dbm or Database Manager library" PStore: "PStore implements a file based persistence mechanism based on a Hash. "
Out of these, all except Daybreak are in the Ruby standard library.
#!/bin/bash | |
# List most recently modified files (will take time) | |
find $1 -type f -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr | cut -d: -f2- | head -20 | |
# get file permissions for a file | |
perl -e 'printf "%o\n", (stat shift)[2]&07777' SOME-FILE | |
# Convert INT to IPv4 | |
perl -MSocket=inet_ntoa -le "print inet_ntoa(pack(\"N\", shift))" |
[Unit] | |
Description=Datadog | |
Requires=docker.socket | |
After=docker.socket | |
[Service] | |
ExecStartPre=-/usr/bin/docker stop dd-agent | |
ExecStartPre=-/usr/bin/docker rm dd-agent | |
ExecStartPre=/bin/sh -c "docker history datadog/docker-dd-agent:latest >/dev/null || docker pull datadog/docker-dd-agent:latest" | |
ExecStart=/usr/bin/docker run --privileged --name dd-agent -h %H -v /var/run/docker.sock:/var/run/docker.sock -v /proc/mounts:/host/proc/mounts:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -e API_KEY=DATADOG_API_KEY datadog/docker-dd-agent |
require 'optparse' | |
require 'ostruct' | |
require 'json' | |
require 'date' | |
def opts | |
@opts ||= OpenStruct.new( | |
verbose: false, | |
region: 'us-east-1', | |
aws_profile: 'default', |
Many different applications claim to support regular expressions. But what does that even mean?
Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.
The information here is just copied from: http://regular-expressions.mobi/refflavors.html