Skip to content

Instantly share code, notes, and snippets.

Avatar

andreis

View GitHub Profile
@pesterhazy
pesterhazy / git-ag
Created Mar 1, 2014
Search your git repository using ag (the silver searcher)
View git-ag
#!/bin/bash
# Put additional ignore patterns (one by line) in .grepignore
#
git-ag () {
if [[ "$1" = "-a" ]]
then
all=1
shift
View gist:5f97d8db71776b188820
typedef struct chan_t
{
pthread_mutex_t m_mu;
pthread_cond_t m_cond;
int closed;
void (* dispose)(struct chan_t * self);
...
} chan_t;
View gist:b282171c988e05b9ddab
func (self *Security) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
// Browser CORS
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
// http://www.html5rocks.com/en/tutorials/cors/
origin := r.Header.Get(mjdlib.HttpHeaderKeyOrigin);
// Browser CORS Origin: a Preflight Request (OPTIONS)
if r.Method == "OPTIONS" {
mjdlib.LogInfo("**CORS OPTIONS URL %v: \n request = %v\n", r.RequestURI, r)
@JosephRedfern
JosephRedfern / Speedtest
Last active Sep 16, 2015
Scaleway ARM machine
View Speedtest
root@beryllium:~# wget http://cachefly.cachefly.net/100mb.test
converted 'http://cachefly.cachefly.net/100mb.test' (ANSI_X3.4-1968) -> 'http://cachefly.cachefly.net/100mb.test' (UTF-8)
--2015-09-03 11:28:49-- http://cachefly.cachefly.net/100mb.test
Resolving cachefly.cachefly.net (cachefly.cachefly.net)... 62.210.187.96
Connecting to cachefly.cachefly.net (cachefly.cachefly.net)|62.210.187.96|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104857600 (100M) [application/octet-stream]
Saving to: '100mb.test'
100mb.test 100%[==========================================================================================================================================>] 100.00M 50.1MB/s in 2.0s
anonymous
anonymous / db.go
Created Jan 24, 2012
Go SDK for Dropbox
View db.go
package dropbox
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
View tweetnote_1.md

This is total shit quickly banged out in probably hard to follow semi-formalism.

TL/DR part, skip to next section

Complex numbers (C) can be viewed as a scalar bivector pair. A 2D bivector requires 1 element (note 1), so we have C ~= R1+R1 ~= R2 with basis {1,i}.

Denote a complex number: z = a+bi = (a, b), {a,b} on R. Associating C with R2 we can interpret (a,b) as a coordinate (in the plane). Functions over C map coordinates in the plane to other coordinates in the plane. We can define principle value (single valued) functions for: log, exp and powers (among others).

For power we can rewrite 'z' into a polar form z = m(cos(a), sin(a)), m >= 0, a on [pi,-pi). Then the princle power can be denoted as:

zt = mt(cos(ta), sin(ta))

@nf
nf / analyze.go
Last active Jan 12, 2016
'spent' script to log where time is spent
View analyze.go
package main
import (
"bufio"
"fmt"
"net/url"
"os"
"regexp"
"sort"
"strconv"
@cecilemuller
cecilemuller / readme.md
Last active Jan 29, 2016
Let's encrypt (Nginx, Ubuntu 14.04 LTS)
View readme.md

Install the client:

apt-get install git
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt

Generate certificates using manual mode:

@mdigital
mdigital / tarsnap-install.sh
Created Apr 18, 2012
Debian / Ubuntu Tarsnap installation
View tarsnap-install.sh
#!/bin/sh
# Installs tarsnap client on Debian and Ubuntu
#
# You'll need to setup an account at
# http://www.tarsnap.com
# and load it with some funds
#
# Make sure you run this as root
#
@houmei
houmei / bcdall0.v
Created Jan 27, 2013
FizzBuzz by FPGA DE0 (QuartusII,verilog)
View bcdall0.v
module bcdall0(BCD3,BCD2,BCD1,BCD0, lampoff);
input [3:0] BCD3;
input [3:0] BCD2;
input [3:0] BCD1;
input [3:0] BCD0;
output lampoff;
assign lampoff=(BCD0==4'd0)&(BCD1==4'd0)&(BCD2==4'd0)&(BCD3==4'd0);
endmodule