Skip to content

Instantly share code, notes, and snippets.

View mrdaemon's full-sized avatar

Alexandre Gauthier mrdaemon

View GitHub Profile
/* -
* TP No. 1
* "Doing Melissa's programming homework out of boredom"
* (c) 2010-2011
* Alexandre Gauthier <[email protected]>
*
* Specifications:
*
* Read 10 numbers from the user and store them in an array
* of 10 elements.
/* hello.c generated by valac 0.11.1, the Vala compiler
* generated from hello.vala, do not modify */
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
public class HelloWorld : Object {
public string name { get ; set; default = "World"; }
public HelloWorld() {
/* Huh. With properties accessed like fields,
and able to have default values, turns out I don't
actually have to do this. At all. Sweet shorthand,
Vala. Your syntactic sugar is growing on me. */
//this.with_name("World");
}
@mrdaemon
mrdaemon / .logo.rc.sh
Created December 30, 2010 05:52
This is the script exec'ed by my .bashrc that displays a crappy ascii 'picture' and text centered on screen as a banner. It was annoying to write, is completely useless and full of bashisms, but is interesting nonetheless.
#!/bin/bash
#
# rc.logo - Crappy welcome mat for unix shells
# 2010-2011 Alexandre Gauthier <[email protected]>
#
# Displays usless ascii logo, information and random niceties
# on login.
#
#####################################################################
@mrdaemon
mrdaemon / hyperv-r2-configonly-import.ps1
Created December 29, 2010 19:36
Work in progress. cmdlet to import a config-only VM export on Hyper-V 2008 R2.
<#
.SYNOPSIS
Safely Imports Hyper-V Virtual Machines that were exported
as configuration only, without State Data (snapshots, VHDs, etc).
.DESCRIPTION
Hyper-V 2008 R2 removed the option to export a Virtual Machine without
its State Data (Snapshots, Virtual Disk Images (VHDs), Suspend State),
as configuration only through the GUI.
@mrdaemon
mrdaemon / copysfc.sh
Created December 15, 2010 22:46
Copy corrupt/missing files from windows sfc log from known good windows 7 install mounted at /media/wsystem. Thank you sfc for creating logs that are impossible to parse without sed grep and awk magic.
grep -i -e "could not" -e "cannot" sfclog.txt | \
awk -F ';' '{ print $1; }' | awk -F "??" '{ print $3; }' | \
sed -e 's/^\\//' -e 's/"\\\[.*\]"/\\/g' -e 's/"$//' | sort | uniq | \
tee -a ./win7sysfiles/FILELIST.TXT | \
sed -e '/^$/d' -e 's/\\/\//g' -e 's/^C:\(.*\)$/\/media\/wsystem\1/' \
-e 's/\([ ()]\)/\\\1/g' | \
while read i ; do if [ -f "$i" ] ; then STATUS="ERROR" ; \
cp "$i" ./win7sysfiles/ && STATUS="COPIED" ; else STATUS="MISSING" ; fi ; \
printf "%-30s%-30s\n" "`basename \"$i\"`" "[$STATUS]" ; done \
&& echo -n "Creating checkums..." ; for f in ./win7sysfiles/* ; do \