We have moved: https://github.com/magnetikonline/linuxmicrosoftievirtualmachines
Due to the popularity of this Gist, and the work in keeping it updated via a Gist, all future updates will take place at the above location. Thanks!
http://net.tutsplus.com/tutorials/other/8-regular-expressions-you-should-know/ | |
# insert a new line with '<null\>' as content every 6th line between lines 100 and 2000 | |
100,2000s/\v(.*\n){6}/\0\<null\/\>\r/g | |
see http://stackoverflow.com/questions/10413906/how-to-add-a-line-after-every-few-lines-in-vim | |
# delete blank lines | |
:g/^$/d | |
# join all lines |
#!/bin/bash | |
# convert DjVu -> PDF | |
# usage: djvu2pdf.sh <file.djvu> | |
# depends on ddjvulibre package, To install package run `sudo apt-get install ddjvulibre` | |
i="$1" | |
echo "------------ converting $i to PDF ----------------"; | |
o="`basename $i .djvu`" | |
o="$o".pdf |
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf | |
found at https://bbs.archlinux.org/viewtopic.php?id=65036 |
def process(input) | |
commands = { | |
'q' => 'Goodbye', | |
'tweet' => 'tweeting', | |
'dm' => 'direct messaging', | |
'help' => 'helping' | |
} | |
if command = commands[input] | |
puts command |
{-# LANGUAGE EmptyDataDecls #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE QuasiQuotes #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeSynonymInstances #-} | |
{-# OPTIONS_GHC -fno-warn-orphans #-} |
We have moved: https://github.com/magnetikonline/linuxmicrosoftievirtualmachines
Due to the popularity of this Gist, and the work in keeping it updated via a Gist, all future updates will take place at the above location. Thanks!
#ifndef WIN32_NO_STATUS | |
# define WIN32_NO_STATUS | |
#endif | |
#include <windows.h> | |
#include <assert.h> | |
#include <stdio.h> | |
#include <winerror.h> | |
#include <stddef.h> | |
#include <winnt.h> | |
#include <limits.h> |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
const int infinity = 2147483647; | |
struct edge_t { | |
int v1; | |
int v2; | |
int cost; |
import Data.Vector ((!)) | |
import qualified Data.Vector as V | |
import Data.Vector.Generic.Mutable (write) | |
step ws state = case updatable of [] -> state | |
(i,_):_ -> V.modify (\v -> write v i (o i)) state | |
where | |
n = V.length state | |
w i j = ws ! i ! j |
/** | |
* converts cartesion to polar coordinates | |
* result: | |
* [0] = length | |
* [1] = angle z-axis rotation [-PI, PI](range) Z軸回転 | |
* [2] = angle of projection into x,y, plane with x-axis [-PI, PI](range) | |
*/ | |
static ofVec3f cartesianToPolar(const ofVec3f &v) | |
{ | |
ofVec3f polar; |