Skip to content

Instantly share code, notes, and snippets.

@albttx
albttx / script.sql
Created October 28, 2021 11:11
Glide SQL keys
DROP TABLE IF EXISTS keys;
CREATE TABLE keys (
key_name VARCHAR(128) UNIQUE NOT NULL PRIMARY KEY,
context VARCHAR(128) NOT NULL,
position INTEGER NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
@albttx
albttx / script.sql
Created April 29, 2021 09:39
DEMO - postgresql hashid
-- Using script https://github.com/array-analytics/plpg_hashids
DROP TABLE fruits;
CREATE TABLE fruits (
id SERIAL UNIQUE NOT NULL,
hash_id VARCHAR(16) PRIMARY KEY
DEFAULT hashids.encode(currval(pg_get_serial_sequence('fruits', 'id')), 'SALT', 16),
fruit_name VARCHAR
@albttx
albttx / main.go
Created January 13, 2020 09:17
oauth2 facebook login
package main
// from: https://stackoverflow.com/questions/27368973/golang-facebook-authentication-using-golang-org-x-oauth2
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
@albttx
albttx / index.js
Created October 23, 2018 17:07
React Native simple mobx
import React from 'React';
import { View, Button, Text } from 'react-native';
import { observable, computed, action } from 'mobx';
import { observer } from 'mobx-react';
class _TodosService {
i = 1
@observable todos = [
{name: "Test_0", done: false}
]
@albttx
albttx / README.md
Created May 29, 2018 20:38 — forked from clhenrick/README.md
PostgreSQL & PostGIS cheatsheet (a work in progress)
@albttx
albttx / hasmany.go
Created December 13, 2017 15:49
Golang GORM has_many exemple
package main
import (
"fmt"
"log"
"github.com/Sirupsen/logrus"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
)

Keybase proof

I hereby claim:

  • I am albttx on github.
  • I am alebatt (https://keybase.io/alebatt) on keybase.
  • I have a public key whose fingerprint is 656F E39D 06B0 B77F 7D7B 4DBE 6ECD B1C9 555B CE18

To claim this, I am signing this object:

@albttx
albttx / LFS-5
Last active December 6, 2016 12:44
#!/bin/bash
LFS=/mnt/ft_linux
LFS_TGT=$(uname -m)-lfs-linux-gnu
SRCS=$LFS/sources
ARCHIVES=$SRCS/archives
TAR="tar -xvf"
LOGFILE=$LFS/install_log.txt
###################################
@albttx
albttx / client.go
Created September 30, 2016 14:04
ZeroMQ test wtf
package main
import (
"log"
zmq "github.com/zeromq/goczmq"
)
func create_dealer() *zmq.Sock {
dealer, err := zmq.NewDealer("tcp://127.0.0.1:7878")
class Tree
attr_reader :data
def initialize(data)
@data = data
end
def +(other)
Tree.new(deep_merge(@data, other.is_a?(Tree) ? other.data : other))
end