Skip to content

Instantly share code, notes, and snippets.

View nrk's full-sized avatar
🤔
はい、猫のように見えます。

Daniele Alessandri nrk

🤔
はい、猫のように見えます。
View GitHub Profile
prefvmx.allVMMemoryLimit = "3000" ; Limite massimo di RAM host utilizzabile dalle VM (in megabyte, es. 3GB)
prefvmx.minVmMemPct = "100" ; Usa solo la RAM host per allocare memoria guest
prefvmx.useRecommendedLockedMemSize = "TRUE" ; Prealloca tutta la memoria del guest all'avvio della VM
mainMem.useNamedFile = "FALSE" ; Disabilita i file .vmem per lo swap di memoria guest
@nrk
nrk / MasterSlaveClusterInitializer.php
Created February 15, 2013 11:47
This is an example of a cluster (client-side sharding) of "virtual" nodes each one configured in a master/slave replication setup.
<?php
namespace Nrk\Predis;
use Nrk\Predis\Connection\MasterSlaveWrapperConnection;
use Predis\Cluster\Distribution\HashRing;
use Predis\Connection\PredisCluster;
use Predis\Option\ClientOptions;
class MasterSlaveClusterInitializer
@nrk
nrk / gemfile_changelog.rb
Created November 22, 2012 09:30 — forked from thbar/gemfile_changelog.rb
Get Changelogs for outdated gems in Gemfile
#!/usr/bin/env ruby
def changelog_for_gem(gem)
changelogs = `bundle exec gem contents #{gem}`.lines.grep(/history|changelog|news/i)
if changelogs.empty?
puts "No changelog found for gem #{gem}"
return nil
end
@nrk
nrk / gist:3417659
Created August 21, 2012 17:37 — forked from avalanche123/gist:981817
GitHub Emoji
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb:
@nrk
nrk / output.txt
Created April 4, 2012 13:51
Graph of the instant bitrate of a video stream using spark
adaniele@psamathe ~/Desktop % ./video-bitrate.rb 20120315_15s.mp4 | spark
▃▆▃▂▃▆█▆▅▇▆▅▇▆▆▁
@nrk
nrk / command.txt
Created April 2, 2012 19:19
Using ffprobe to get info from a file in a nice JSON format
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"
@nrk
nrk / hack.sh
Created March 31, 2012 19:47 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@nrk
nrk / global_lock.rb
Created March 27, 2012 15:06
Single instance check with ruby and windows
require 'win32/mutex'
require 'windows/error'
def with_global_lock(lockname, &block)
mutex = Win32::Mutex.new(true, lockname)
if mutex.GetLastError == Windows::Error::ERROR_ALREADY_EXISTS
raise RuntimeError, 'Already running!'
end
@nrk
nrk / _details.md
Created November 26, 2011 09:21
Data for OrientDB issue #617

See this bug report for more details.

Judging from serverside_capture.txt (which contains a fragment of the HTTP traffic captured on the server side using a packet sniffer), when the bug is triggered it looks like OrientDB returns a correct value for the Content-Length header but writes the whole response buffer exactly twice and it's not the buffer left from a previous request since my test case alternates two different SELECT queries. Unsurprisingly this seems to break cURL because, when it's able to keep the underlying connection open, it reads spurious data from the previous response instead of the expected HTTP headers.

As far as I can tell, but I can't yet be sure of what I'm going to write, this bug might not even be actually related to the practice of reusing the underlying connection. When a new connection is used for each new request, cURL reads up to $CONTENT_LENGTH bytes fro

@nrk
nrk / README.md
Created November 16, 2011 14:17
CI stuff for the Orient PHP library.

This repository contains the stuff needed to run the full test suite of Orient on Travis CI.