Skip to content

Instantly share code, notes, and snippets.

View beyoung's full-sized avatar
🥋
Focusing

beyoung beyoung

🥋
Focusing
View GitHub Profile
@beyoung
beyoung / my_postgre.conf
Created May 11, 2020 04:25 — forked from smellman/my_postgre.conf
OpenMapTiles 差分アップデート
listen_addresses = '*'
# Tuning at: https://pgtune.leopard.in.ua/
# DB Version: 9.6
# OS Type: linux
# DB Type: dw
# Total Memory (RAM): 16 GB
# CPUs num: 20
# Connections num: 100
# Hard drive type: ssd
@beyoung
beyoung / index.html
Created February 9, 2020 05:36 — forked from twelch/index.html
Mapbox GL JS compare window circle magnifying glass
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.css' rel='stylesheet' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.1.0/mapbox-gl-compare.js'></script>
</head>
<body>
@beyoung
beyoung / index.html
Created February 9, 2020 05:36 — forked from twelch/index.html
Mapbox GL JS compare window circle magnifying glass
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.css' rel='stylesheet' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.1.0/mapbox-gl-compare.js'></script>
</head>
<body>
@beyoung
beyoung / factories.py
Created October 31, 2019 13:54 — forked from xuru/factories.py
Factory boy example
# -*- coding: utf-8 -*-
"""Factories to help in tests."""
import random
from datetime import date
import factory
# noinspection PyPackageRequirements
from faker import Faker
from .database import db
from xxx.controllers import User
@beyoung
beyoung / gist:650e70d4542fd85325124895846216a1
Created July 30, 2019 07:33 — forked from dlau/gist:6774515
load planet.osm admin boundaries into postgres
note: set accordingly
export PATH=$PATH:/users/daryl/dev/gis/osmosis/package/bin
note: is space delimited
export JAVACMD_OPTIONS="-Xmx5G -Djava.io.tmpdir=/Volumes/1TBHD0/tmp"
osmosis \
--read-pbf planet-latest.osm.pbf \
--tf accept-nodes "boundary=administrative" \
--tf reject-relations \
import os
import aiohttp
import json
import base64
import asyncio
import uvloop
START_ID = 1000
END_ID = 1020
@beyoung
beyoung / jit.c
Created March 30, 2019 15:01 — forked from skeeto/jit.c
Basic JIT
/* http://redd.it/2z68di */
#define _BSD_SOURCE // MAP_ANONYMOUS
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/mman.h>
#define PAGE_SIZE 4096
@beyoung
beyoung / rownum.sql
Created March 21, 2019 10:35 — forked from tototoshi/rownum.sql
Grouped LIMIT in PostgreSQL: show the first N rows for each group
-- http://stackoverflow.com/questions/1124603/grouped-limit-in-postgresql-show-the-first-n-rows-for-each-group
-- http://www.postgresql.jp/document/9.2/html/tutorial-window.html
CREATE TABLE empsalary (
depname varchar(10) not null
, empno integer not null
, salary integer not null
);
INSERT INTO empsalary (depname, empno, salary) VALUES ('develop', 11, 5200);
@beyoung
beyoung / asymmetric.go
Created February 12, 2019 15:35 — forked from cryptix/LICENSE
example of using JWT for http authentication in go
package main
// using asymmetric crypto/RSA keys
import (
"crypto/rsa"
"fmt"
"io/ioutil"
"log"
"net/http"
@beyoung
beyoung / server.js
Created February 28, 2018 07:25 — forked from zimmicz/server.js
PostGIS MVT Express routing
const express = require("express")
const app = express()
const { Pool } = require("pg")
const SphericalMercator = require("sphericalmercator")
const pool = new Pool({
host: "localhost",
port: 15432,
user: "postgres",
database: "postgres"
})