Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
prabirshrestha / gist:2927082
Created June 13, 2012 23:11
connect-assetmanager & snockets
var Snockets = require('snockets'),
snockets = new Snockets(),
assets = {};
exports.snockets = function(file, path, index, isLast, callback) {
return snockets.getConcatenation(path, {
// minify: true
}, function(err, js) {
if (js) {
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP\Parameters]
"DisableServerHeader"=dword:00000001
updating cache ./config.cache
creating ./config.status
creating Makefile
sed: file conftest.s1 line 26: unterminated `s' command
creating Src/Makefile
sed: file conftest.s1 line 26: unterminated `s' command
creating Doc/Makefile
sed: file conftest.s1 line 26: unterminated `s' command
creating Etc/Makefile
sed: file conftest.s1 line 26: unterminated `s' command
@prabirshrestha
prabirshrestha / CMakeLists.txt
Created July 7, 2012 02:08
force clang for CMakeLists.txt
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
project(hello)
add_executable(hello hello.c)
@prabirshrestha
prabirshrestha / Makefile
Created July 7, 2012 06:35
Makefile with sources/objects/executable
CC=clang
CFLAGS=-c -Wall
LDFLAGS=
SOURCES=hello.c
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=hello
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
@prabirshrestha
prabirshrestha / isElevated.cmd
Created July 10, 2012 01:35
detect if running in elevated mode in windows
Whoami /groups /fo csv /nh|Find "12288"
Whoami /groups /fo csv /nh|Find "12288">Nul&&Goto RestOfScript
@prabirshrestha
prabirshrestha / detect-os.sh
Created July 10, 2012 02:04
detect os in bash
#!/bin/sh
UNAME=$(uname)
if [ "$UNAME" == "Linux" ] ; then
echo "Linux"
elif [ "$UNAME" == "Darwin" ] ; then
echo "Darwin"
elif [[ "$UNAME" == CYGWIN* || "$UNAME" == MINGW* ]] ; then
@prabirshrestha
prabirshrestha / install.sh
Created July 10, 2012 03:43
dotfiles install
#!/bin/bash
set -e
if [ -d ~/.dotfiles ]
then
echo "You already have .dotfiles installed. You'll need to remove ~/.dotfiles if you want to install"
exit 1
fi
echo "Cloning .dotfiles"
@prabirshrestha
prabirshrestha / Program.cs
Created July 11, 2012 20:26
azure queue poller
private async Task BatchPoll()
{
var cts = new CancellationTokenSource();
var task = CloudQueuePoller.Poll(c =>
{
var connectionString = "UseDevelopmentStorage=true";
var storageAccount = CloudStorageAccount.Parse(connectionString);
var queueClient = storageAccount.CreateCloudQueueClient();
var queue = queueClient.GetQueueReference(QueueName);
#define ASYNC_TARGETTING_PACK
// http://blog.smarx.com/posts/managing-concurrency-in-windows-azure-with-leases
namespace BlobLeaser
{
using System;
using System.IO;
using System.Net;
using System.Threading;