Skip to content

Instantly share code, notes, and snippets.

View carlosmn's full-sized avatar
💭
Buried under a heap of yaks under a stack of todos

Carlos Martín Nieto carlosmn

💭
Buried under a heap of yaks under a stack of todos
View GitHub Profile
@carlosmn
carlosmn / newly-unreachable.rb
Created February 6, 2012 23:47
A libgit2 implementation of git fsck --unreachable
#!/usr/bin/env ruby
require 'rubygems'
require 'rugged'
require 'set'
def objects_in_tree(repo, tree, objs)
tree.each do |e|
objs << e[:oid]
if e[:type] == :tree then
Stack overflow in unmanaged: IP: 0x7f7b0a88e33c, fault addr: 0x7f7afbc07f88
Stack overflow: IP: 0x7f7b0a88e33c, fault addr: 0x7f7afbbfef98
Stacktrace:
at <unknown> <0xffffffff>
at System.Net.Dns.GetHostByName (string) [0x0001d] in <a9a08e39ba304bd0a84c49bd158dfc02>:0
<...>
at System.Net.Dns.GetHostEntry (string) [0x00062] in <a9a08e39ba304bd0a84c49bd158dfc02>:0
at System.Net.Dns.GetHostAddresses (string) [0x00066] in <a9a08e39ba304bd0a84c49bd158dfc02>:0
at System.Net.Sockets.TcpClient.Connect (string,int) [0x00064] in <a9a08e39ba304bd0a84c49bd158dfc02>:0
at Meebey.SmartIrc4net.IrcConnection.Connect (string[],int) [0x001ac] in /home/carlos/smuxi/lib/SmartIrc4net/src/IrcConnection/IrcConnection.cs:616
source 'https://rubygems.org'
gem "sd_notify"
// Perform snapshot of domain console
func DomainVNCSnapshot(w http.ResponseWriter, r *http.Request) {
ruuid := chi.URLParam(r, "uuid")
errstr := "Failure retrieving VM details"
domobj, err := GetDomObj(ruuid)
if err != nil {
http.Error(w, errstr, http.StatusInternalServerError)
return
}
defer domobj.Free()
@carlosmn
carlosmn / rewrite-lg2s.sh
Last active October 29, 2017 08:58
An extremely case-specific implementation of git-filter-branch
#!/bin/bash
# It's no libgit2, but it's pretty useful
. $(git --exec-path)/git-sh-setup
cd_to_toplevel
require_clean_work_tree
set -e
@carlosmn
carlosmn / anfile.md
Created September 12, 2017 07:44
An gist

An content

@carlosmn
carlosmn / Main.cs
Last active March 10, 2017 17:28
Gtk#-3 with GtkBuilder
using System;
using Gtk;
namespace builder
{
class MainWin
{
[Gtk.Builder.Object("window1")] Window window1;
public void OnToggled(object sender, EventArgs args)
{
% make
Making all in sources
make[1]: Entering directory `/home/carlos/apps/webkit-sharp/sources'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/carlos/apps/webkit-sharp/sources'
Making all in sources/glue
make[1]: Entering directory `/home/carlos/apps/webkit-sharp/sources/glue'
/bin/bash ../../libtool --tag=CC --mode=compile gcc -DPACKAGE_NAME=\"webkitgtk-sharp\" -DPACKAGE_TARNAME=\"webkitgtk-sharp\" -DPACKAGE_VERSION=\"1.10.2\" -DPACKAGE_STRING=\"webkitgtk-sharp\ 1.10.2\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"webkitgtk-sharp\" -DVERSION=\"1.10.2\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I. -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gtk-3.0 -I/usr/include/libsoup-2.4 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/i
@carlosmn
carlosmn / main.c
Created October 25, 2012 13:44
Fußgängerampel-Simulation
#define SLEEP_QUANTUM 10000
#define SLEEP(n) do { \
long time = n * 100000; /* wait() sleeps 10*n microseconds */ \
while(time > SLEEP_QUANTUM) { \
wait(SLEEP_QUANTUM); \
time -= SLEEP_QUANTUM; \
} \
wait(time); \
} while(0)
@carlosmn
carlosmn / web.go
Created October 17, 2012 18:57
A mock git-http-backend to test pushing
package main
import (
"io"
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, req *http.Request) {
req.ParseForm()