Skip to content

Instantly share code, notes, and snippets.

@denji
denji / golang-tls.md
Last active May 29, 2024 10:16 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@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"
@fboris
fboris / stm_native_bootloader.md
Last active September 27, 2023 09:23
dfu-util command for uploading firmware on ST devices
  1. Let device to enter dfu-mode. And use dfu-util to get available devices

sudo dfu-util -l

It will show like...

Found DFU: [0483:df11] ver=2100, devnum=32, cfg=1, intf=0, alt=3, name="@Device Feature/0xFFFF0000/01*004 g", serial="3262355B3231"
Found DFU: [0483:df11] ver=2100, devnum=32, cfg=1, intf=0, alt=2, name="@OTP Memory /0x1FFF7800/01*512 g,01*016 g", serial="3262355B3231"
Found DFU: [0483:df11] ver=2100, devnum=32, cfg=1, intf=0, alt=1, name="@Option Bytes  /0x1FFFC000/01*016 g", serial="3262355B3231"
@stuart-warren
stuart-warren / simple-gpg-enc.go
Last active May 20, 2024 09:57
golang gpg/openpgp encryption/decryption example
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"io/ioutil"
"log"
"os"
)
@glamrock
glamrock / torrc_options
Created August 25, 2014 02:17
All valid torrc options
yahtzee@fagballs:~# tor --list-torrc-options
Aug 24 22:16:31.701 [notice] Tor v0.2.4.20 (git-0d50b03673670de6) running on Linux with Libevent 2.0.21-stable and OpenSSL 1.0.1f.
Aug 24 22:16:31.701 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
AccountingMax
AccountingStart
Address
AllowDotExit
AllowInvalidNodes
AllowNonRFC953Hostnames
AllowSingleHopCircuits
@willprice
willprice / .travis.yml
Last active August 15, 2023 17:12
How to set up TravisCI for projects that push back to github
# Ruby is our language as asciidoctor is a ruby gem.
lang: ruby
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
@staltz
staltz / introrx.md
Last active June 7, 2024 23:39
The introduction to Reactive Programming you've been missing
@hyg
hyg / gist:9c4afcd91fe24316cbf0
Created June 19, 2014 09:36
open browser in golang
func openbrowser(url string) {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
err = exec.Command("open", url).Start()
@bradleypeabody
bradleypeabody / gist:185b1d7ed6c0c2ab6cec
Last active November 29, 2023 22:08
golang, convert UTF-16 to UTF-8 string
package main
// http://play.golang.org/p/fVf7duRtdH
import "fmt"
import "unicode/utf16"
import "unicode/utf8"
import "bytes"
func main() {
@hvoecking
hvoecking / translate.go
Last active March 28, 2024 13:52
Golang reflection: traversing arbitrary structures
// Traverses an arbitrary struct and translates all stings it encounters
//
// I haven't seen an example for reflection traversing an arbitrary struct, so
// I want to share this with you. If you encounter any bugs or want to see
// another example please comment.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Heye Vöcking
//