This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use_bpm 100 | |
live_loop :pad do | |
chords = [ | |
[:a2, :g3, :c4, :e4], | |
[:d2, :f3, :c4, :e4], | |
[:g2, :f3, :a3, :d4], | |
[:c2, :g3, :d4, :e4] | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
每个平台的信号定义或许有些不同。下面列出了POSIX中定义的信号。 Linux 使用34-64信号用作实时系统中。 命令man 7 signal提供了官方的信号介绍。
在POSIX.1-1990标准中定义的信号列表
NewerOlder