Skip to content

Instantly share code, notes, and snippets.

View zeroidentidad's full-sized avatar
:shipit:
00:00 [ᴢᴇʀᴏ]~ go run .

フ乇丂ひ丂 zeroidentidad

:shipit:
00:00 [ᴢᴇʀᴏ]~ go run .
View GitHub Profile
@zeroidentidad
zeroidentidad / diskusage.go
Created September 26, 2023 04:14
get the disk usage of a directory.
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() {
path, _ := os.Getwd()
@zeroidentidad
zeroidentidad / sql1992.txt
Created September 14, 2023 02:52
SQL Standard
This file has been truncated, but you can view the full file.
(This is stale and you may wish to find a more up-to-date copy, but it is preserved here for posterity. Enjoy -- Daria 24 Nov 2017)
@zeroidentidad
zeroidentidad / Dockerfile
Created July 9, 2023 17:11
alpine with go
FROM alpine:latest
RUN apk add --no-cache git make musl-dev go
# Configure Go
ENV GOROOT /usr/lib/go
ENV GOPATH /go
ENV PATH /go/bin:$PATH
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin

Go Stdlib Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

All of the following information is based on go version go1.8.3 darwin/amd64.

@zeroidentidad
zeroidentidad / go.SliceTricks.md
Last active January 18, 2023 03:06
Go Slice Tricks Cheat Sheet

Since the introduction of the append built-in, most of the functionality of the container/vector package, which was removed in Go 1, can be replicated using append and copy.

Here are the vector methods and their slice-manipulation analogues:

AppendVector

@zeroidentidad
zeroidentidad / gist:d18a263885c5f82a33b8622e623e5542
Created September 23, 2022 19:14 — forked from alexedwards/gist:dc3145c8e2e6d2fd6cd9
Example of working with Go's database/sql and NULL fields
CREATE TABLE books (
isbn char(14) NOT NULL,
title varchar(255),
author varchar(255),
price decimal(5,2)
);
INSERT INTO books (isbn, title, author, price) VALUES
('978-1503261969', 'Emma', 'Jayne Austen', 9.44),
('978-1514274873', 'Journal of a Soldier', NULL, 5.49),
@zeroidentidad
zeroidentidad / gaia_localidades.go
Last active September 29, 2022 04:31
API endpoint procesador intermediario personalizado de localidades de Mexico via webservice Gaia del INEGI
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
type GaiaTruncatedData struct {
@zeroidentidad
zeroidentidad / ember.js
Last active June 24, 2023 14:57
Classic Ember.js CheatSheet
/*
* -----------------------
* Classic Ember.js Cheatsheet
* -----------------------
*
* Docs: https://guides.emberjs.com/
* Quick start: https://guides.emberjs.com/current/getting-started/quick-start/
*
* Table of contents
* -------------------
@zeroidentidad
zeroidentidad / script_pixel.sh
Last active June 29, 2022 21:21
Run ADV emulator externally
#!/usr/bin/env bash
# pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY chmod 777 /dev/kvm - stackoverflow.com/questions/37300811/android-studio-dev-kvm-device-permission-denied
export ANDROID_EMULATOR_LAUNCHER_DIR=/home/zeroidentidad/Android/Sdk/emulator
export LD_LIBRARY_PATH=/home/zeroidentidad/Android/Sdk/emulator/lib64/qt/lib:/home/zeroidentidad/Android/Sdk/emulator/lib64/libstdc++:/home/chucho/Android/Sdk/emulator/lib64/gles_angle11:/home/zeroidentidad/Android/Sdk/emulator/lib64/gles_angle9:/home/zeroidentidad/Android/Sdk/emulator/lib64/gles_angle:/home/zeroidentidad/Android/Sdk/emulator/lib64/gles_swiftshader:/home/zeroidentidad/Android/Sdk/emulator/lib64
EMULATOR86="/home/zeroidentidad/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64"
EMULATOR="/home/zeroidentidad/Android/Sdk/emulator/emulator"
DEVICE=`$EMULATOR -list-avds tail -1`
RUN="$EMULATOR86 -netdelay none -netspeed full -avd $DEVICE"
@zeroidentidad
zeroidentidad / sendMail.go
Created August 30, 2021 18:43 — forked from narukoshin/sendMail.go
Send SMTP email with Go
package main
import (
"crypto/tls"
"errors"
"log"
"net"
"net/smtp"
"strings"
)