This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
#### | |
# Converts Safaris history file (history.plist) into csv (tab) | |
# Dependency: nokogiri | |
# Usage: ruby read.rb input.plist output.csv | |
### | |
require "rubygems" | |
require "nokogiri" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
display dialog "Number of random notes?" default answer "1" | |
set iterations to (text returned of result) | |
tell application "Evernote" | |
-- Fetch all notebooks that the notes shoukd be randomized from | |
set allNotebooks to every notebook whose name does not contain "kentor" and notebook type is synchronized | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name vasttrafiklabs | |
// @description Removes the nag screen from labs.vasttrafik.se | |
// @grant none | |
// @version 0.0.23 | |
// @include https://labs.vasttrafik.se/* | |
// @include http://labs.vasttrafik.se/* | |
// ==/UserScript== | |
var elements = document.getElementsByTagName("div"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Adds story/ticket number to original git commit template | |
# Add this file to .git/hooks/ | |
git_commit_file=$1 | |
temp=`mktemp /tmp/git-commit-message-XXXXXX` | |
story_number=`git branch | grep '^\*' | grep -o '[1-9][0-9]*$'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
module StringToDatetimeForSoap | |
def to_datetime | |
begin | |
if /^([+\-]?\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d(?:\.(\d*))?)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ self.strip | |
return Time.xmlschema(self).localtime | |
end | |
super | |
rescue | |
# If a invalid date is supplied, it will automatically turn it into the first Julian Day |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bunny = Bunny.new(:host => "localhost" ) | |
bunny.start | |
APP_CONFIG[:asset_sync_bindings].each do |e| | |
queue = bunny.queue e[:queue], :durable => true | |
exchange = bunny.exchange e[:exchange] , :durable => true , :type => :fanout | |
queue.bind exchange | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2012-02-08 04:00:49 CET [11602]: [2-1] DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory. | |
2012-02-08 04:00:49 CET [11602]: [3-1] HINT: In a moment you should be able to reconnect to the database and repeat your command. | |
2012-02-08 04:00:50 CET [31876]: [13-1] LOG: all server processes terminated; reinitializing | |
2012-02-08 04:00:56 CET [31876]: [14-1] FATAL: could not create shared memory segment: Kan inte allokera minne | |
2012-02-08 04:00:56 CET [31876]: [15-1] DETAIL: Failed system call was shmget(key=5444001, size=9673490432, 03600). | |
2012-02-08 04:00:56 CET [31876]: [16-1] HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space. To reduce the request size (currently 9673490432 bytes), reduce PostgreSQL's shared_buffers parameter (currently 1152000) and/or its max_connections parameter (currently 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def serialize(key, value, options=nil) | |
marshalled = false | |
value = unless options && options[:raw] | |
marshalled = true | |
begin | |
Marshal.dump(value) | |
rescue => ex | |
# Marshalling can throw several different types of generic Ruby exceptions. | |
# Convert to a specific exception so we can special case it higher up the stack. | |
exc = Dalli::MarshalError.new(ex.message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "bunny" | |
require "pp" | |
bunny = Bunny.new(:host => "127.0.0.1", :port => 15672) | |
bunny.start | |
pp bunny.status | |
# Send message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adding a tweet with an array of tags and an array with weights for each detected language. | |
curl -XPUT http://localhost:9201/twitter/tweet/1 -d ' | |
{ | |
"tags" : ["foo", "bar"], | |
"weights" : [{"lang":"eng", "weight":0.97}, {"lang":"swe", "weight":0.03}] | |
} | |
' | |
{"ok":true,"_index":"twitter2","_type":"tweet","_id":"1","_version":1} | |
-------- |
NewerOlder