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()
(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
@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)
@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)),
@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
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 / 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'
@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 / 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