Skip to content

Instantly share code, notes, and snippets.

View beyoung's full-sized avatar
🥋
Focusing

beyoung beyoung

🥋
Focusing
View GitHub Profile
@beyoung
beyoung / SwiftUICoreMotionView.swift
Created December 22, 2023 07:38 — forked from saamerm/SwiftUICoreMotionView.swift
Sample using CoreMotion and SwiftUI to help understand how to use CMMotionManager and CoreMotion to get values of gravity, user acceleration, heading (2), attitude (pitch, roll, yaw), magnetic field
// Sample using CoreMotion and SwiftUI to help understand how to use CMMotionManager and CoreMotion to get values of gravity, user acceleration, heading (2), attitude (pitch, roll, yaw), magnetic field
// based on this beautiful example https://github.com/gsachin/DynamicFontRandD/blob/e4f7cc611d1d23573b4026bcc291bee60bf60e91/FontTextStrok/WaveView.swift
// that uses BAFluidView https://github.com/antiguab/BAFluidView
import SwiftUI
import CoreMotion
let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
struct WaveView: View {
var motionManager = CMMotionManager()
{
"hostName": "fred.stlouisfed.org",
"series": {},
"chart": {
"labels": {
"title": "Bank Prime Loan Rate",
"subtitle": "Source: Board of Governors of the Federal Reserve System (US)",
"left_axis": "Percent",
"right_axis": "",
"bottom_axis": "",
(Dijkstra and plain A* are generally not included here as there are thousands of
implementations, though I've made an exception for rare Ruby and Crystal versions,
and for Thor, Mapzen's enhanced A*. )
A* Ruby https://github.com/georgian-se/shortest-path
A* Crystal https://github.com/petoem/a-star.cr
A* (bidirectional with shortcuts) C++ https://github.com/valhalla/valhalla
NBA* JS https://github.com/anvaka/ngraph.path
NBA* Java https://github.com/coderodde/GraphSearchPal
NBA* Java https://github.com/coderodde/FunkyPathfinding
CREATE TABLE orders (
id serial,
user_id int4,
create_time timestamp(0)
) PARTITION BY RANGE(user_id);
CREATE TABLE orders_100000 PARTITION OF orders FOR VALUES FROM (1) TO (100000);
CREATE TABLE orders_200000 PARTITION OF orders FOR VALUES FROM (100000) TO (200000);
@beyoung
beyoung / Dockerfile
Last active August 1, 2023 02:15 — forked from ciiiii/Dockerfile
Postgresql for Chinese Full-Text Search.中文全文搜索
# If you don‘t want to build it youself, you can try `docker pull killercai/postgres`.
FROM healthcheck/postgres:latest
# China debian mirror
RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN apt-get clean && apt-get update
RUN apt-get install -y wget git build-essential libpq-dev python-dev postgresql-server-dev-all
# SCWS (Simple Chinese Word Segmentation library)
RUN cd /tmp && wget -q -O - http://www.xunsearch.com/scws/down/scws-1.2.1.tar.bz2 | tar xjf - && cd scws-1.2.1 && ./configure && make install
# zhpaser (postgres plugin)
import * as fs from 'fs';
import { polygon, featureCollection } from '@turf/helpers';
import booleanIntersects from '@turf/boolean-intersects'
const degrees = 6
const featureArray = []
// create a geojson feature collection using TurfJS
var collection = featureCollection(featureArray)
@beyoung
beyoung / country-bounding-boxes.py
Created September 2, 2022 11:45 — forked from graydon/country-bounding-boxes.py
country bounding boxes
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@beyoung
beyoung / .tmux.conf
Created February 28, 2022 02:55 — forked from shanzi/.tmux.conf
My tmux configuration
run-shell "powerline-daemon -q"
source "$HOME/.local/lib/python3.8/site-packages/powerline/bindings/tmux/powerline.conf"
set -g default-terminal "xterm-256color"
# set-option -g default-command "/usr/local/bin/reattach-to-user-namespace -l /bin/zsh"
# install reattach-to-user-namespace first
# --> brew install reattach-to-user-namespace
new-session
@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