Skip to content

Instantly share code, notes, and snippets.

@mostlygeek
mostlygeek / fib.cs
Created May 20, 2011 15:11
C# Fibonacci Generator
using System;
using System.Collections;
namespace CSharpFib
{
class MainClass
{
public static void Main(string[] args)
{
foreach (ulong x in Fibber(5)) {
@mostlygeek
mostlygeek / set-date.sh
Created February 24, 2011 18:50
Runs ntpdate if the clock is off by more than 10 seconds. Useful for VMhosts
#!/bin/sh
DIFF=`ntpdate -q pool.ntp.org | awk '/offset ([-0-9\.]+) sec/ {i=int($10); print (i >= 0) ? i : 0 - i}'`
# set the date if the difference is > 10 seconds
if [ $DIFF -gt 10 ];
then
echo -n "Time off by $DIFF seconds. Setting date ..."
sudo ntpdate pool.ntp.org
echo "one";
<!DOCTYPE html5>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Testing of Components</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
$(function() {
// benchmark async fetching of 10 files
/**
* Trying out different code approaches to break out of a
* deep callback chain in node.js
*
*/
/**
* TEST #1 - Using a try/catch block
*/
(function (throwError) {