Skip to content

Instantly share code, notes, and snippets.

View prasmussen's full-sized avatar

Petter Rasmussen prasmussen

View GitHub Profile
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#define CMD_OFFSET 2
#define MAX_CMD_LENGTH 2048
int strlen_total(char **str, int length) {
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <fcntl.h>
#define MB 1000 * 1000
#define GB 1000 * MB
@prasmussen
prasmussen / gist:4157259
Created November 27, 2012 21:39
snapshots cron
# * * * * * command to be executed
# ┬ ┬ ┬ ┬ ┬
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └───── day of week (0 - 7) (0 or 7 are Sunday, or use names)
# │ │ │ └────────── month (1 - 12)
# │ │ └─────────────── day of month (1 - 31)
# │ └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)
@prasmussen
prasmussen / test.js
Created October 25, 2012 16:23
wolfram module test
var time = require("./time.js");
time.now({callback: function(msg) {
console.log("This will be printed to irc:");
console.log(msg);
}});
#!/usr/bin/node
var args = process.argv;
if (args.length < 3) {
console.log("Usage: " + args[1] + " <text file>");
process.exit(1);
}
fs = require('fs');
fs.readFile(args[2], function(err, data) {
@prasmussen
prasmussen / makepasswd.sh
Created June 15, 2012 10:15
Smartos shadow hash generator
#!/bin/bash
read -s -p "New Password: " password
echo
read -s -p "Re-enter new Password: " confirm
echo
if [ "$password" != "$confirm" ]; then
echo "Password don't match!"
exit 1
fi
@prasmussen
prasmussen / gist:2890229
Created June 7, 2012 17:34
go-template-example
package main
import (
"fmt"
"bytes"
"text/template"
)
type Person struct {
Name string