Skip to content

Instantly share code, notes, and snippets.

Matthew Mueller matthewmueller

Block or report user

Report or block matthewmueller

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@miguelmota
miguelmota / timestamp_to_unix.sql
Created May 2, 2019
PostgreSQL timestamp datetime to unix timestamp integer
View timestamp_to_unix.sql
-- assuming created_at is timestamp column
extract(epoch from created_at)::numeric::integer
@rylev
rylev / learn.md
Created Mar 5, 2019
How to Learn Rust
View learn.md

Learning Rust

The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.

Warning

Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.

The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.

@miguelmota
miguelmota / rsa_util.go
Last active Nov 14, 2019
Golang RSA encrypt and decrypt example
View rsa_util.go
package ciphers
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"encoding/pem"
"log"
)
@nat-n
nat-n / Recipe-bundling-fonts-with-headless-chrome.md
Last active Oct 31, 2019
How to build a fontconfig bundle for adding arbitrary fonts to headless chrome independent of the OS. This is specifically useful for deploying headless chrome to AWS lambda where it is necessary to include fonts for rendering CJK (Chinese, Japanese, Korean) characters into the deployed bundle.
View Recipe-bundling-fonts-with-headless-chrome.md

Building fontconfig

Start up a lambda-like docker container:

docker run -i -t -v /tmp:/var/task lambci/lambda:build /bin/bash

Install some dependencies inside the container:

yum install gperf freetype-devel libxml2-devel git libtool -y
easy_install pip
@creack
creack / main.go
Created Jan 7, 2018 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
View main.go
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
@devinodaniel
devinodaniel / gist:8f9b8a4f31573f428f29ec0e884e6673
Created Nov 21, 2017
Generate SSH RSA Private/Public Key pair with Golang
View gist:8f9b8a4f31573f428f29ec0e884e6673
// This shows an example of how to generate a SSH RSA Private/Public key pair and save it locally
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"golang.org/x/crypto/ssh"
View options.go
package main
import "fmt"
// WithPrefix
type prefixOption struct{}
func WithPrefix() interface {
GetOption
@PurpleBooth
PurpleBooth / Dockerfile
Last active Nov 17, 2019
Create a static binary in go and put it in a from scratch docker container
View Dockerfile
FROM golang:1.9
WORKDIR /go/src/github.com/purplebooth/example
COPY . .
RUN go build -ldflags "-linkmode external -extldflags -static" -a main.go
FROM scratch
COPY --from=0 /go/src/github.com/purplebooth/example/main /main
CMD ["/main"]
@levelsio
levelsio / btc-eth-dca-buy.php
Last active Aug 6, 2019
This script runs daily and "Dollar Cost Average"-buys $40 BTC and $10 ETH per day
View btc-eth-dca-buy.php
<?
//
// [ BUY BTC & ETH DAILY ON BITSTAMP ]
// by @levelsio
//
// 2017-08-23
//
// 1) buy $40/day BTC
// 2) buy $10/day ETH
//
@tj
tj / snippets.coffee
Last active Sep 1, 2018
Atom snippets for Go
View snippets.coffee
'.source.go':
'Options':
'prefix': 'options'
'body': '''
// Option function.
type Option func(*$1)
// New with the given options.
func New(options ...Option) *$1 {
You can’t perform that action at this time.