Skip to content

Instantly share code, notes, and snippets.

-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGNBF+oGtwBDADHB31hc511enJ2+8Gxvu3QAal6lx6fCuwSm/Gh4auEjGU3Mt8D
gcne03tZLGlQTLMGKcg/5Bs1wqPsrHG3iKEYINfs5gr9GUmcqQ7Bz9cNn7LUqaHC
iU92HeS12sslWKvihoZ1B2UWaQeFdUDbKoB0p0vsETpXGON19/W7d2a1fzSh1P6n
iOQUUipK2pYesslmfhXIGPp+gSJPr1sRAJwEaGLdj8bdUX6pQyAq6A3zKcEydhUD
QoZr9p9OU43el4E9aOA9CIKnWuapxwlo1AcPlEzzJ7ib3gYxplkaMyqc0/4zRpw+
TpMDv995q4hhXf1/jwApsfyXq8QBjSjURSOtkzmtUE5xdO/dSwakhmdHHA3JjSt3
yqhe96YzHdKNUV+FNuj1Fr/wtNeNGAhxINAqtzH9089wBHCnsJiN5SLgyjpC6Ley
0dJlWKVO41P0d6YBCEdi5cGSRzxArvKZF3s6XQ4kf7M0gl71VnhzFAVFdnBv6Avr
package main
import (
"encoding/hex"
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"strings"
from os import path
from urllib.request import urlopen
from bs4 import BeautifulSoup
import justext
WORLD_URL = 'https://www.theguardian.com/world?page=%d'
URLS = [WORLD_URL % i for i in range(1, 11)]
DEST_DIR = './articles'

Root Certificate

Create the Root Certificate

This is done only once. Created private key is the basis of all trust for all other certificates, so never ever let anyone see it.

openssl genrsa -out root.key 2048
@husio
husio / auth.py
Created November 14, 2016 17:26
Service authentication in python.
from datetime import datetime, timedelta
import base64
import json
from oauth2client.service_account import ServiceAccountCredentials
import httplib2
class Authenticator:
def __init__(self, auth_service_url):
@husio
husio / x.vim
Created April 27, 2015 06:55
Vim colorscheme, created for Go
" Vim color file
" Maintainer: Piotr Husiatyński <[email protected]>
set background=dark
set t_Co=256
let g:colors_name="x"
hi Normal ctermfg=255 ctermbg=233 cterm=None
hi SpecialKey ctermfg=87 ctermbg=None cterm=Bold
@husio
husio / indexer.go
Created February 6, 2015 18:57
index
package main
import (
"bufio"
"io"
"unicode"
)
const (
ngramSize = 3
package main
import (
"container/list"
)
type Lru struct {
maxsize int
order *list.List
elems map[string]*list.Element
package main
import (
"html/template"
"log"
"net/http"
"github.com/stretchr/gomniauth"
"github.com/stretchr/gomniauth/common"
"github.com/stretchr/gomniauth/providers/google"
@husio
husio / microweb.py
Created February 1, 2013 14:14
few lines of python + webob to make a real microframework ;)
import collections
import re
from wsgiref import simple_server
from webob import Request, Response
class App:
def __init__(self):