Skip to content

Instantly share code, notes, and snippets.

@sweemeng
sweemeng / example.py
Last active August 19, 2023 05:00
Example code for SQS worker
import boto3
class ApplicationSpecificError(Exception):
pass
# You probably want to wrap this in a function, or put in a main() function
sqs = boto3.client('sqs')
import argparse
import subprocess
from langchain.prompts import PromptTemplate
from langchain.llms import OpenAI
from langchain.chains import LLMChain
from dotenv import load_dotenv
load_dotenv()
@sweemeng
sweemeng / README.md
Last active November 6, 2021 10:33
Edge Impulse example for Wio Terminal
@sweemeng
sweemeng / main.ino
Created October 10, 2021 10:48
This is a demo with Arduino for Wio Terminal. This is the demo that assumes that you have the library and board set up on the Arduino IDE. I go look at ways to do it in platform.io later
#include "Keyboard.h"
#include"TFT_eSPI.h"
#define NOOP 0
#define PRESS 1
#define UP 2
#define DOWN 3
#define LEFT 4
#define RIGHT 5
#define MODE_NOOP 0
@sweemeng
sweemeng / README.md
Last active August 9, 2021 12:59
Error Log for my code
@sweemeng
sweemeng / gesture_capture.ino
Last active May 30, 2021 13:09
This is the arduino part of the gesture classifier
#include <Arduino.h>
#include <Arduino_LSM9DS1.h>
// I am copying from arduino gesture to emoji to try understand how data collection work.
const float accThreshold = 2.5;
const int numSamples = 119;
int sampleRead = numSamples;
void setup() {
from transformers import pipeline
import requests
import pprint
def load_hn():
hn_feed = requests.get("https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty")
data = hn_feed.json()
return data
const puppeteer = require('puppeteer')
const fs = require('fs')
const extractor = async url => {
const browser = await puppeteer.launch({
headless: true,
slowMo: 1500
})
const scrapeTime = Date.now()
const page = await browser.newPage()
@sweemeng
sweemeng / button_record.py
Created May 5, 2019 08:49
m5stack to influxdb
from m5stack import *
from m5ui import *
import time
import struct
import network
import urequests
import ujson
def push_data(button_name):
lcd.clear()