Skip to content

Instantly share code, notes, and snippets.

@timvisee
timvisee / falsehoods-programming-time-list.md
Last active Dec 6, 2021
Falsehoods programmers believe about time, in a single list
View falsehoods-programming-time-list.md

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@curi0usJack
curi0usJack / .htaccess
Last active Dec 6, 2021
FYI THIS IS NO LONGER AN .HTACCESS FILE. SEE COMMENTS BELOW. DON'T WORRY, IT'S STILL EASY.
View .htaccess
#
# TO-DO: set |DESTINATIONURL| below to be whatever you want e.g. www.google.com. Do not include "http(s)://" as a prefix. All matching requests will be sent to that url. Thanks @Meatballs__!
#
# Note this version requires Apache 2.4+
#
# Save this file into something like /etc/apache2/redirect.rules.
# Then in your site's apache conf file (in /etc/apache2/sites-avaiable/), put this statement somewhere near the bottom
#
# Include /etc/apache2/redirect.rules
#
@subfuzion
subfuzion / dep.md
Last active Sep 23, 2021
Concise guide to golang/dep
View dep.md

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

@danesparza
danesparza / exec.go
Last active Aug 26, 2021
Go exec.Command example
View exec.go
package main
import (
"bytes"
"fmt"
"os/exec"
"strings"
)
func main() {
@drernie
drernie / csvtomap.go
Created Mar 10, 2017
Golang Convert CSV Records to Dictionaries using Header Row as Keys
View csvtomap.go
// CSVToMap takes a reader and returns an array of dictionaries, using the header row as the keys
func CSVToMap(reader io.Reader) []map[string]string {
r := csv.NewReader(reader)
rows := []map[string]string{}
var header []string
for {
record, err := r.Read()
if err == io.EOF {
break
}
@rohanthewiz
rohanthewiz / xmlparser_conversion.go
Created Mar 2, 2017
Converting from iso-8859-1 to utf-8
View xmlparser_conversion.go
package xmlparser
import (
"os"
"golang.org/x/text/encoding/charmap"
"log"
"bytes"
"io"
"strings"
)
@amlwwalker
amlwwalker / emailheader.go
Last active Jun 26, 2018
check spf, dmarc, dkim
View emailheader.go
package main
import (
"fmt"
"net"
"regexp"
"encoding/base64"
"crypto/x509"
"crypto/rsa"
// "math/big"
@jim3ma
jim3ma / starttls_smtp_example.go
Last active Oct 6, 2021 — forked from chrisgillis/ssl_smtp_example.go
Golang StartTLS SMTP Example
View starttls_smtp_example.go
package main
import (
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"crypto/tls"
)
View Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
@vi
vi / rust_wine.md
Last active Jul 13, 2021
Using Rust in Wine as a sort of cross-compiler
View rust_wine.md

Cross-compiling Rust from Linux to Windows using Wine

🔴 Note: this article is obsolete. This cross-compilation direction may just work out of the box. 🔴

0. Ensure Rust works on Host

Let's create a dummy project for a test.

$ cargo new test