Skip to content

Instantly share code, notes, and snippets.

View beyoung's full-sized avatar
🥋
Focusing

beyoung beyoung

🥋
Focusing
View GitHub Profile
import os
import aiohttp
import json
import base64
import asyncio
import uvloop
START_ID = 1000
END_ID = 1020
@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 \
@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 / 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 / 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 / README.md
Created May 22, 2020 08:49 — forked from hellokaton/README.md
Go 的信号处理和优雅退出

每个平台的信号定义或许有些不同。下面列出了POSIX中定义的信号。 Linux 使用34-64信号用作实时系统中。 命令man 7 signal提供了官方的信号介绍。

在POSIX.1-1990标准中定义的信号列表

@beyoung
beyoung / mock-object-property.py
Created September 16, 2020 01:31 — forked from igniteflow/mock-object-property.py
How to mock an object property in Python
import mock
with mock.patch('path.to.ObjectClass.my_property', new_callable=mock.PropertyMock) as mock_my_property:
mock_my_property.return_value = 'my value'
use_bpm 100
live_loop :pad do
chords = [
[:a2, :g3, :c4, :e4],
[:d2, :f3, :c4, :e4],
[:g2, :f3, :a3, :d4],
[:c2, :g3, :d4, :e4]
]
@beyoung
beyoung / omercy.py
Created July 14, 2021 08:01 — forked from Krazybug/omercy.py
O'Reilly free ebooks downloader
'''
O'Meirrcy !!!! Download free ebooks from O'Reilly
Usage:
> git clone https://gist.github.com/Krazybug/1ae50814d25b0a1d862dfdf7161ee503
> mv 1ae50814d25b0a1d862dfdf7161ee503 omercy
> cd omercy
> pip install requests
> pip install bs4
> python omercy.py