Skip to content

Instantly share code, notes, and snippets.

View faloi's full-sized avatar

Federico Aloi faloi

  • Argentina
View GitHub Profile
@faloi
faloi / gist:3192277
Created July 28, 2012 07:40
pool de memcached
memcached_return cache_create(const char* ip, int port, int max_instances) {
memcached_server_st *server = NULL;
memcached_return ret_cache;
connections = sync_queue_create();
server = memcached_server_list_append(server, ip, port, &ret_cache);
int i;
for (i = 0; i < max_instances; i++) {
memcached_st* cache = memcached_create(NULL);
@faloi
faloi / gitinit.sh
Last active October 10, 2015 20:38
First-time Git setup with ssh
NAME=$1
EMAIL=$2
done_message() {
echo "Done!"
echo ""
}
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Couldn't run script!"
@faloi
faloi / ssh-agent-init
Last active October 11, 2015 03:18
Initializing ssh-agent at startup
SSH_ENV=$HOME/.ssh/environment
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
echo succeeded
chmod 600 ${SSH_ENV}
. ${SSH_ENV} > /dev/null
/usr/bin/ssh-add;
}
@faloi
faloi / .gitconfig
Last active October 12, 2015 18:28
My gitconfig file
[color]
ui = true
[user]
name = Federico Aloi
email = federico.aloi@gmail.com
[alias]
all = commit -a -m
amend = commit --amend --no-edit
adduntracked = !git add $(git ls-files -o --exclude-standard)
discard = checkout --
public class ActionMock<T>
{
private int TimesExecuted { get; set; }
public Action<T> Action { get; private set; }
public ActionMock()
{
this.Action = _ => this.TimesExecuted++;
}
@faloi
faloi / remove_version_attribute.rb
Created February 14, 2013 21:25
remove_version
require 'Nokogiri'
xmlWildcard = "C:/Users/feder_000/Documents/Workspace/parsimotion/pages/**/*.xml"
allXmls = Dir[xmlWildcard]
allXmls.each{ |xml|
doc = Nokogiri::XML(open(xml))
begin
doc.search('Page').attribute('Version').remove
@faloi
faloi / azure_publish.ps1
Last active December 14, 2015 07:28
Powershell script used to upload a package to Windows Azure. Requires Azure Powershell to work
Param(
[string]$subscription,
[string]$service,
[string]$storageAccount,
[string]$slot,
[string]$package,
[string]$configuration,
[string]$publishSettingsPath
)
@faloi
faloi / 52-np900x4c-clickpad.conf
Created March 31, 2013 03:11
Touchpad configuration for Samsung NP900x-400c. It should be placed in /usr/share/X11/xorg.conf.d
Section "InputClass"
Identifier "np900x4c clickpad"
MatchIsTouchpad "on"
Driver "synaptics"
# Enable the clickpad and set click actions
Option "ClickPad" "1"
Option "ClickFinger1" "1"
Option "ClickFinger2" "3"
Option "ClickFinger3" "2"
private void AgregarMovimiento(string codigo, string detalle, string numComprobante, DateTime fecha, string tipoMovimiento, string deposito, string subdeposito, string destino, decimal cantidad)
{
if (numComprobante == "")
{
MessageBox.Show("Ingrese un número de comprobante.", "Falta ingresar comprobante",
MessageBoxButtons.OK, MessageBoxIcon.Error);
numeroComprobanteTextBox.Focus();
}
else if ((tipoMovimiento == "Transferencia") && (deposito == destino))
{
public static IEnumerable<Type> GetConcreteSubtypes(this Type anInterface)
{
var types = anInterface.Assembly.GetTypes();
return types.Where(type => (type.IsSubclassOf(anInterface) || type.GetInterfaces().Contains(anInterface)) && !type.IsAbstract);
}