Skip to content

Instantly share code, notes, and snippets.

View nazt's full-sized avatar

Nat nazt

  • Chiang Mai Maker Club
  • Chiang Mai
  • X @nazt
View GitHub Profile
@nazt
nazt / LINE-BOT-GAS-SAMPLE.js
Created May 24, 2020 12:22 — forked from nwatab/LINE-BOT-GAS-SAMPLE.js
Supporterz 2 and 24, October, 2018
We couldn’t find that file to show.
@nazt
nazt / fix_parallels_tools_install.md
Created May 6, 2020 15:17 — forked from xiaozhuai/fix_parallels_tools_install.md
fix parallels tools install issue

install log

cd prl_fs/SharedFolders/Guest/Linux/prl_fs && make CC=cc
make[1]: Entering directory '/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs'
make -C /lib/modules/5.0.0-25-generic/build M=/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs CC=cc
make[2]: Entering directory '/usr/src/linux-headers-5.0.0-25-generic'
  CC [M]  /usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.o
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c: In function 'prlfs_remount':
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:119:21: error: 'MS_RDONLY' undeclared (first use in this function); did you mean 'IS_RDONLY'?
  if ( (!((*flags) & MS_RDONLY) && PRLFS_SB(sb)->readonly) ||
@nazt
nazt / fix_parallels_tools_install.md
Created May 6, 2020 15:17 — forked from xiaozhuai/fix_parallels_tools_install.md
fix parallels tools install issue

install log

cd prl_fs/SharedFolders/Guest/Linux/prl_fs && make CC=cc
make[1]: Entering directory '/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs'
make -C /lib/modules/5.0.0-25-generic/build M=/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs CC=cc
make[2]: Entering directory '/usr/src/linux-headers-5.0.0-25-generic'
  CC [M]  /usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.o
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c: In function 'prlfs_remount':
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:119:21: error: 'MS_RDONLY' undeclared (first use in this function); did you mean 'IS_RDONLY'?
  if ( (!((*flags) & MS_RDONLY) && PRLFS_SB(sb)->readonly) ||
@nazt
nazt / hello_multiprocessing.py
Created February 10, 2020 09:51 — forked from baojie/hello_multiprocessing.py
Python multiprocessing hello world. Split a list and process sublists in different jobs
import multiprocessing
# split a list into evenly sized chunks
def chunks(l, n):
return [l[i:i+n] for i in range(0, len(l), n)]
def do_job(job_id, data_slice):
for item in data_slice:
print "job", job_id, item
@nazt
nazt / single
Created October 19, 2019 03:52 — forked from tibaes/single
IPython display cv images
# Using docker goldenheart:1.1.0
# pip3 install matplotlib
# Import the required modules
%pylab inline
import cv2
from IPython.display import clear_output
frame = cv2.imread("image.jpg")
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
from matplotlib import pyplot as plt
import cv2
img = cv2.imread('/Users/mustafa/test.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
plt.imshow(gray)
plt.title('my picture')
plt.show()
@nazt
nazt / showarray.py
Created October 18, 2019 06:37 — forked from kylemcdonald/showarray.py
Minimal code for rendering a numpy array as an image in a Jupyter notebook in memory. Borrowed from the Deep Dream notebook.
import PIL.Image
from cStringIO import StringIO
import IPython.display
import numpy as np
def showarray(a, fmt='png'):
a = np.uint8(a)
f = StringIO()
PIL.Image.fromarray(a).save(f, fmt)
IPython.display.display(IPython.display.Image(data=f.getvalue()))
@nazt
nazt / 1-standard.js
Created August 25, 2019 15:05 — forked from vladfr/1-standard.js
Use async/await and for..of in Cloud Firestore
// In a Firestore standard example, we quickly create a 'xmas tree' of nested stuff
// We use Promises directly: get().then(callback) and use snapshot.forEach() to iterate
let campaignsRef = db.collection('campaigns');
let activeCampaigns = campaignsRef.where('active', '==', true).select().get()
.then(snapshot => {
snapshot.forEach(campaign => {
console.log(campaign.id);
let allTasks = campaignsRef.doc(campaign.id).collection('tasks').get().then(
snapshot => {
snapshot.forEach(task => {
If you follow instruction at https://github.com/RAKWireless/RUI_Platform_Firmware_GCC.
And work, that will be fine. For me, that not work well. I feel like i live in space. Yeah!
Install arm-none-eabi
DO NOT USE LASTEST VERSION -> i use version 7.2.1 (GNU Tools for Arm Embedded Processors 7-2017-q4-major)
You can use lower version
- download from here https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads/7-2017-q4-major-1-1
[Check here for more information https://gist.github.com/joegoggins/7763637]
In winodw if you use cygwin that RAKWireless recommended, you NEED to install "make" too. Because "make" not include.
@nazt
nazt / node-s.js
Last active January 26, 2019 15:14 — forked from allfake/node-s
node-s.js
const SerialPort = require('serialport')
const port = new SerialPort('/dev/tty.usbmodem0006826707061', {
baudRate: 9600//115200
})
const Delimiter = require('@serialport/parser-delimiter')
const parser = port.pipe(new Delimiter({ delimiter: '\n' }))
// console.log(Buffer.from([0xff]))
const delay = require('delay');