Skip to content

Instantly share code, notes, and snippets.

View ngs's full-sized avatar
🎣
Fly Fishing

Atsushi NAGASE ngs

🎣
Fly Fishing
View GitHub Profile
@ngs
ngs / colors.js
Last active December 15, 2021 16:57
// http://jan5.fc2web.com/model/mr_color.html
[cols, ...rows] = $$('table[border="1"] tr').map(tr => Array.from(tr.childNodes).filter(cn => cn.nodeName === 'TD').map(td => td.getAttribute('bgcolor') || td.innerText))
'| ' + cols.join(' | ') + ' |\n| ---- | ---- | ---- | ---- | ---- | ---- |\n| ' + rows.map(row => row.join(' | ').replace(/\n/g, '<br>')).join(' |\n| ').replace(/#([A-F0-9]{6})/g, '![$1](https://dummyimage.com/20x20/$1/fff&text=+)')
# /etc/systemd/system/gpio-watch.service
[Unit]
Description=gpio-watch is a tool for running scripts in response to GPIO events.
[Service]
User=root
WorkingDirectory=/root
ExecStart=/usr/bin/gpio-watch 6:rising
Restart=always
@ngs
ngs / inspect.sh
Last active December 15, 2021 16:58
MusicDir = /home/pi/music
ALSADevice = default
ALSAMixer1 = Headphone
#ALSAMixer2 = Master
ALSAStutterDefeat = no
#include <Arduino_MKRIoTCarrier.h>
MKRIoTCarrier carrier;
float temperature = 0;
float humidity = 0;
float pressure = 0;
float gyroscope_x, gyroscope_y, gyroscope_z;
float accelerometer_x, accelerometer_y, accelerometer_z;
float pixel = 3, r = 25, g = 20, b = 40;
int none = 0;
int light = 1;
// tinyCylon_2_1.c
// 22 february 2010 - dale wheat - added mode memory
// based on tinyCylon2.c
// revised firmware for tinyCylon LED scanner
// written by dale wheat - 18 november 2008
// based on behavior of original tinyCylon firmware
// notes:
// device = ATtiny13A
# https://docs.docker.com/engine/install/ubuntu/
apt-get update -y
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
/**
* Responds to any HTTP request.
*
* @param {!express:Request} req HTTP request context.
* @param {!express:Response} res HTTP response context.
*/
const fetch = require('node-fetch');
exports.handle = async (req, res) => {
@ngs
ngs / s3podcast.js
Last active December 15, 2021 16:59
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
exports.handler = async (event) => {
const filename = 'feed.xml';
const { bucket, object } = event.Records[0].s3;
const { eventTime, awsRegion } = event.Records[0];
const date = new Date(eventTime).toUTCString();
console.info(JSON.stringify(event, null, 2));
const res = await s3.getObject({ Bucket: bucket.name, Key: filename }).promise();
@ngs
ngs / map.geojson
Last active January 22, 2020 00:30
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.