Skip to content

Instantly share code, notes, and snippets.

View frank7y's full-sized avatar

Francesco frank7y

View GitHub Profile
@npearce
npearce / sort_array_of_JSON_objects.js
Last active June 26, 2024 15:50
Sort Array of JSON Object by date values
// Sort array of JSON objects by date value
const records = [
{
order_id: 12345,
order_date: "2020-03-23"
},
{
order_id: 12346,
order_date: "2020-03-20"
},
@FLamparski
FLamparski / pm-basic.ino
Created June 5, 2019 10:48
Simple ESP32/Arduino program for reading the SDS-011 output in continuous mode
void setup() {
Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, -1, -1, false);
}
void loop() {
if (Serial2.available()) {
byte pm_buf[10];
Serial2.readBytes(pm_buf, 10);
@FLamparski
FLamparski / simple-sds011.py
Created June 5, 2019 10:22
Simplest SDS-011 Python program
import serial
import struct
from datetime import datetime
# Change this to the right port - /dev/tty* on Linux and Mac and COM* on Windows
PORT = 'COM5'
UNPACK_PAT = '<ccHHHcc'
with serial.Serial(PORT, 9600, bytesize=8, parity='N', stopbits=1) as ser:
@FLamparski
FLamparski / plot.py
Created June 5, 2019 10:21
Example programs for the SDS-011
import serial
import struct
from collections import deque
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as anim
from matplotlib.ticker import FuncFormatter
# Change this to the right port - /dev/tty* on Linux and Mac and COM* on Windows
PORT = 'COM5'
@deergod1
deergod1 / pfSense config.md
Last active January 15, 2025 02:49
pfSense Easy Configuration Guide for HP t620 Plus

pfSense Simple Home Configuration - 2.4.3 / 2.4.4

Starting from Scratch

This is my personal guide for installing pfSense. Hope you find it useful. I made these notes to capture the details of my "install from scratch" to ensure I didn't miss important details. Also, I'm trying build my network with discrete "disposable" components that make the system mutable and less rigid. It does not cover installing any packages like Squid or Suricata as that's way beyond the scope of a basic, functional install.

I migrated from an environment that was at various times running Tomato Toastman 1.28 or Asuswrt-Merlin on Netgear and ASUS routers across four "access points" (one always acting as the firewall/gateway, the rest as APs). It was OK pre-gigabit, but had roaming problems, and I was using large Wifi routers with most of the features disabled. Also, I found that I could easily swamp the network and tank VOIP and Wifi Calling without even trying. The only fix was to throttle everything by using Bandwidth Limit

@marw
marw / read_nova_pm_sensor.py
Last active December 11, 2023 03:40
Get reading from Nova PM Sensor SDS011 (dust sensor, air quality sensor, PM10, PM2,5)
#!/usr/bin/env python3
"""
Get reading from Nova PM Sensor SDS011
(dust sensor, air quality sensor, PM10, PM2,5)
Designed to run from cron and append CSV file.
Script tested using Python3.4 on Ubuntu 14.04.

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@kipyegonmark
kipyegonmark / OSX.txt
Last active January 31, 2022 15:22
Useful Mac OSX scripts
# Updating from an Internal Software Update Server
# ------------------------------------------------
# Default Settings:
# blank
# Software updates are downloaded from one of the following software update
# servers hosted by Apple:
# swscan.apple.com:80
# swquery.apple.com:80
# swcdn.apple.com:80
# Suggested Settings:
@kadamski
kadamski / sds011
Last active May 25, 2025 15:37
SDS011 dust sensor reading
#!/usr/bin/python
# coding=utf-8
# "DATASHEET": http://cl.ly/ekot
from __future__ import print_function
import serial, struct, sys, time
DEBUG = 1
CMD_MODE = 2
CMD_QUERY_DATA = 4
CMD_DEVICE_ID = 5

slow

This bash script offers quick shortcuts to simulate slower network connections. It is useful when you need to simulate a wireless network on a Linux network server, especially when you are using a virtual machine guest on your local machine or in the cloud.

slow 3G                   # Slow network on default eth0 down to 3G wireless speeds
slow 3G -l 600ms -p 10%   # slow network on eth0 and setup latency to 600ms packetloss to 10%
slow reset                # Reset connection for default eth0 to normal
slow vsat --latency=500ms # Simulate satellite internet  with a high latency

slow dsl -b 1mbps # Simulate DSL with a slower speed than the default