View how_go_create_http_client_given_cert_data.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func httpClientForCert(t *testing.T, caData, certData, keyData []byte) *http.Client { | |
cert, err := tls.X509KeyPair(certData, keyData) | |
require.NoError(t, err) | |
caCertPool := x509.NewCertPool() | |
require.True(t, caCertPool.AppendCertsFromPEM(caData)) | |
// Setup HTTPS client | |
tlsConfig := &tls.Config{ | |
MinVersion: tls.VersionTLS12, |
View RectangleConfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"defaults" : { | |
"almostMaximizeWidth" : { | |
"float" : 0 | |
}, | |
"curtainChangeSize" : { | |
"int" : 0 | |
}, | |
"allowAnyShortcut" : { | |
"bool" : false |
View main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/rand" | |
"crypto/rsa" | |
"encoding/json" | |
"fmt" | |
"log" | |
jose "gopkg.in/square/go-jose.v2" | |
) | |
func main() { |
View parse.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/xml" | |
"fmt" | |
"io" | |
"os" | |
"regexp" | |
"strings" | |
"time" |
View profile_vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/a/12216578/675100 | |
:profile start profile.log | |
:profile func * | |
:profile file * | |
" At this point do slow actions | |
:profile pause | |
:noautocmd qall! | |
// -------------------- |
View new_gist_file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkfifo fifo | |
TCPHOST="10.0.0.1"; while true ; do \ | |
ssh $TCPHOST 'tcpdump -s 0 -U -n -w - "!igmp && !arp && !rarp && !(host 224.0.0.1) && !(port 22) && !(port 67) && !(port 53) && !(port 123) && !(port 5353) && !(port 137)"' > fifo; \ | |
done | |
# on another console | |
wireshark -k -i fifo |
View fib.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fib_to(n): | |
fibs = [0, 1] | |
for i in range(2, n+1): | |
fibs.append(fibs[-1] + fibs[-2]) | |
return fibs |
View fib.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int fib(int term, int val = 1, int prev = 0) | |
{ | |
if(term == 0) return prev; | |
if(term == 1) return val; | |
return fib(term - 1, val+prev, val); | |
} |
View list.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <assert.h> | |
typedef struct node | |
{ | |
int val; | |
struct node* next; | |
} node; |
NewerOlder