Skip to content

Instantly share code, notes, and snippets.

@cryptix
cryptix / LICENSE
Last active March 10, 2024 09:55
example of using JWT for http authentication in go
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE S
@cryptix
cryptix / vineScrape.go
Created August 27, 2014 12:31
extract a javascript object value from a html page using goquery and otto
package main
import (
"errors"
"log"
"os"
"github.com/PuerkitoBio/goquery"
"github.com/robertkrimen/otto"
)
@cryptix
cryptix / fetch.go
Last active May 3, 2023 06:35
fetch all pdfs from a page
package main
import (
"crypto/sha1"
"fmt"
"io"
"net/http"
"os"
"strings"
"sync"
@cryptix
cryptix / fotos.go
Created June 15, 2014 16:03
revel image upload example
package controllers
import (
"bytes"
"image"
"image/gif"
"image/jpeg"
"image/png"
"io"
"net/http"
@cryptix
cryptix / shell.nix
Created April 9, 2021 09:30
NixOS Shell for cabal-desktop development
with import <nixpkgs> {};
with pkgs;
let cabalEnv = buildEnv {
name = "cabal-desktop-env";
paths = [
# npm sodium stuff
clang
gnumake
libtool
@cryptix
cryptix / client.go
Created June 22, 2014 11:09
multipart upload with io.Pipe
package main
import (
"io"
"log"
"mime/multipart"
"net/http"
"os"
"path/filepath"
"runtime"
@cryptix
cryptix / main.go
Created July 29, 2014 10:16
using go/ast to find specific function calls and the values of a parameter
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"log"
)
@cryptix
cryptix / pgpTestTool.go
Created December 28, 2014 16:20
PGP file encryption in golang
package main
import (
"archive/zip"
"fmt"
"log"
"os"
"time"
"github.com/cryptix/go/logging"
@cryptix
cryptix / complete.txt
Created September 18, 2016 13:33
zcash beta1 build failure (empty object files)
This file has been truncated, but you can view the full file.
+++ readlink -f ./zcutil/build.sh
++ dirname /home/cryptix/zcash/zcutil/build.sh
+ cd /home/cryptix/zcash/zcutil/..
+ LCOV_ARG=
+ HARDENING_ARG=--enable-hardening
+ '[' x-j4 = x--enable-lcov ']'
++ pwd
+ PREFIX=/home/cryptix/zcash/depends/x86_64-unknown-linux-gnu/
+ make -j4 -C ./depends/ V=1 NO_QT=1
make: Entering directory '/home/cryptix/zcash/depends'
@cryptix
cryptix / chat.go
Created February 2, 2013 19:17
simple chat example in go. uses channels to match partners and goroutines for concurency
package main
import (
"fmt"
"io"
"log"
"net"
)
const listenAddr = "localhost:4000"