This is translation of https://zenn.dev/mizchi/articles/introduce-moonbit from japanese
Recently, I came across a language called MoonBit, and the more I looked into it, the more I liked it, so I'd like to introduce it.
This is translation of https://zenn.dev/mizchi/articles/introduce-moonbit from japanese
Recently, I came across a language called MoonBit, and the more I looked into it, the more I liked it, so I'd like to introduce it.
""" | |
Convert the pressed up/down key to the hexcode of all keys and send to BLE | |
""" | |
import sys | |
sys.path.append('..') | |
import keyboard | |
import warnings | |
import serial | |
import serial.tools.list_ports |
#!/bin/bash | |
SECURE_WORD="76492d1116743f0423413b16050a5345MgB8AE4AeQBTAHMAbABvAGEAMAAvADYAdwBiADQASABPAFgAZABVAFYATQAzAHcAPQA9AHwAYgAzAGUAZgBjAGEAZgBiAGQAMwBiAGMAMwBiAGMAZgAwADUAYQAyADEAMABlADgAMABkADEAYgA5AGIAYQA1ADMAYgBlADQAZgBmAGUAYgBhAGUAMAA5ADcAYQA4AGIAMQBiAGMAZQA4AGEAMwBlADQAZQA1ADAANgAyADcAYgBmADIANQA1AGYANgA1ADMAOQAzAGEAZAA4ADIAOAA3ADgANAA5AGIAYwBiAGQAMAA5AGMAYQBmADUAYgA5ADYAOAA4AGQANwBhAGIAYwA1AGIAOQAxAGYAOAAwADIAMgA3ADEAMgBlAGUANAAzADgANgAyADYAMwBhAGIAZgA2ADcAMAA4ADYAMQAzADkAMQA0ADAAYQAzAGQAOAA4ADMAZAAyAGIANAAzAGMAZABmADEAYwBjAGYANwA5ADYAYQAxADIAYwAxAGMAYgA2ADIAOQAwAGQAMQBhAGUAZAA0AGIAOQA5ADkAZABiAGIANABlADAAZQA4ADkANQA2ADQAMQA3AGEAMgAwADYAZQAwAGYAYwA5ADIANQA1ADcAMwA5AGQAMgBjAGIAZgA4AGUANgA0ADYAOQA3ADEAYwBiAGUAOQAwADEANQBkADMAYwAzAGYAZQBjADQAZQA2ADYANAAzADQAYQA1ADMAYQBhAGIAZQBiADgANgA1ADkANwA0ADgAYgA1AGIAOAA3AGYAMwA2ADgAYQA3AGUAMABiAGMAMAAzAGUANQA5ADYAZAAyAGUAMgAzADcAOQA4ADkAZgA4ADkAYwBmADUANwA2AGQAOQBkAGIAOQBkADcAZAAxAGUAYgA2ADgANQAzAGIAYgA0ADkANgAwADgAOABiADYANQBmAGEANQBhADEAMABkAGQANgBmADcANABhAGI |
This is a modified gist of Jake Vanderplas wonderful Numba Ball Tree code from the following gist. This gist basically adds the 'nopython' parameter in the jit decorators from the original gist and parallelizes the nearest neighbor query for each of the points.
With some of the new advances in numba and the modifications
#say `x` is list of noisy values | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
x = np.random.uniform(size=100) | |
mean_x = pd.Series(x).rolling(window=2).mean() |
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install [email protected] | |
brew unlink [email protected] | |
brew link postgresql |
import pandas as pd | |
import pandas.io.sql as sqlio | |
import psycopg2 | |
conn = psycopg2.connect("host='{}' port={} dbname='{}' user={} password={}".format(host, port, dbname, username, pwd)) | |
sql = "select count(*) from table;" | |
dat = sqlio.read_sql_query(sql, conn) | |
conn = None |
/* | |
* Handling Errors using async/await | |
* Has to be used inside an async function | |
*/ | |
try { | |
const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
// Success 🎉 | |
console.log(response); | |
} catch (error) { | |
// Error 😨 |
I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6
apt-get update && apt-get install gdb