Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / gist:950728
Created May 1, 2011 18:49
let g_maxSize = 4480
let fileSizes = [|1 .. 99|]
let optimalResults = Array.init (g_maxSize+1) (fun _ -> Array.create fileSizes.Length 0)
let lastStep = Array.init (g_maxSize+1) (fun _ -> Array.create fileSizes.Length 0)
for containerSize=0 to g_maxSize do
let optimalResultsContainerSize = optimalResults.[containerSize]
let lastStepContainerSize = lastStep.[containerSize]
for idx=0 to fileSizes.Length-1 do
@etaque
etaque / CamelApp.scala
Created February 23, 2013 08:24
Consume ActiveMQ messages with akka-camel
package org.example
import akka.actor._
import akka.camel.{ CamelMessage, Consumer, CamelExtension }
import org.apache.activemq.camel.component.ActiveMQComponent
class CdrLogConsumer extends Actor with Consumer {
def endpointUri = "activemq:FOO.BAR"
def receive = {
@msmorul
msmorul / lync-sample1.py
Created December 10, 2013 23:31
Example python script for authenticating to Lync and creating an application endpoint that lists all of a persons contacts. Python example for what's described here https://ucwa.lync.com/documentation/keytasks-createapplication
import requests
import json
from urlparse import urlparse
sip_domain = "SIP_DOMAIN.COM"
username = "USERNAME@SIP_DOMAIN.COM"
password = "YOUR_LYNC_PASSWORD"
def extractAuthURL(str):
start = str.find('MsRtcOAuth');
@jwmerrill
jwmerrill / gbm.jl
Last active June 29, 2018 04:49
Faster geometric brownian motion
function genS_jl(I)
s0 = 600.0
r = 0.02
sigma = 2.0
T = 1.0
M = 100
dt = T/M
a = (r - 0.5*sigma^2)*dt
b = sigma*sqrt(dt)
@ansantam
ansantam / Ubuntu_at_CERN.md
Last active February 15, 2023 08:10
How to setup your Ubuntu @CERN

CERN Hacks

This Gist is a guide on how to setup your computer at CERN with Ubuntu 14.04 LTS. Last tested by myself on a brand new computer on 18/11/2014, proof tested by @Alea88.

NOTE (26-02-2015)

With the kernel upgrade from 3.13.0-45-generic to 3.13.0-46-generic AFS stops working: https://bugs.launchpad.net/ubuntu/+source/openafs/+bug/1423151

Type this to check your kernel version:

@ssut
ssut / benchmark.py
Last active August 24, 2019 08:54
Python decorator endpoint implementation (like Flask blueprint module) - O(1)
#-*- coding: utf-8 -*-
import time
from collections import namedtuple
from test import ep as app
BenchResult = namedtuple('BenchResult', ['str', 'time'])
def benchmark(str, times=100000):
t_start = time.time()
for i in range(times):
@staltz
staltz / introrx.md
Last active May 10, 2024 12:08
The introduction to Reactive Programming you've been missing
@brenopolanski
brenopolanski / install-firefox-nightly.md
Created July 30, 2014 00:34
Install Firefox Nightly in Ubuntu via PPA

via: http://www.webupd8.org/2011/05/install-firefox-nightly-from-ubuntu-ppa.html

Add the Mozilla Daily PPA (available for Ubuntu 11.04, 10.10 and 10.04) and install Firefox Nightly using the commands below:

$ [sudo] add-apt-repository ppa:ubuntu-mozilla-daily/ppa
$ [sudo] apt-get update
$ [sudo] apt-get install firefox-trunk

Since this is a daily builds PPA, it's nowhere near stable so use it at your own risk!

@aaronhurt
aaronhurt / curltest.c
Last active November 26, 2023 10:29
example code using libcurl and json-c to post and parse a return from http://jsonplaceholder.typicode.com
/**
* example C code using libcurl and json-c
* to post and return a payload using
* http://jsonplaceholder.typicode.com
*
* License:
*
* This code is licensed under MIT license
* https://opensource.org/licenses/MIT
*