Skip to content

Instantly share code, notes, and snippets.

// Homespan firmware for ESP32 rgb led strip of NEOPIXEL/WS2812B
#if defined(CONFIG_IDF_TARGET_ESP32)
#define NEOPIXEL_RGB_PIN 32
#endif
#include "HomeSpan.h"
#include "extras/Pixel.h" // include the HomeSpan Pixel class
///////////////////////////////
# Print with colors exmaple
class color:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
@josephsamela
josephsamela / kibana-timelion-example.txt
Last active April 2, 2021 18:19
Kibana Timelion - Average metric over time with trendline
.es(
index=name_of_index,
timefield='name_of_timefield',
metric='avg:name_of_metric'
).yaxis(
label="Y-Axis_label",
min=75,
max=85
).title("Title of average metric vs. Time"),
.es(
ffmpeg -f mp3 -i https://22203.live.streamtheworld.com/WNPRFM.mp3 -acodec pcm_s16le -ar 8000 -ac 1 -f wav npr.wav
import requests
import json
url = "https://outlook.office.com/webhook/<webhookuuid>/IncomingWebhook/<webhookuuid>"
payload = json.dumps(
{"text":"Hello world!"}
)
headers = {'Content-Type': 'application/json'}
import os
import time
import re
from bs4 import BeautifulSoup
import csv
from prettytable import PrettyTable
import threading
import queue
run = True
import math
def pi_chudnovsky(one=1000000):
"""
Calculate pi using Chudnovsky's series
This calculates it in fixed point, using the value for one passed in
"""
k = 1
a_k = one
declare -a ACTIONS=(
"createIncomingHook"
"getIncomingHooks"
"deleteIncomingHook"
"updateIncomingHook"
"createOutgoingHook"
"getOutgoingHooks"
"deleteOutgoingHook"
"updateOutgoingHook"
"getCommands"
@josephsamela
josephsamela / screencast.sh
Created December 20, 2018 03:51
ffmpeg screencast
#!/bin/bash
ffmpeg -f x11grab -framerate 30 -video_size 1680x1050 -i :1.0 -vcodec libx264 -pix_fmt yuv420p -threads 0 -vf "scale=1280:720" output.mp4
@josephsamela
josephsamela / gitlab-ci.yml
Last active November 7, 2018 19:14
Gitlab CI/CD pipeline to automate building packages for mutliple versions of Python
stages:
- build
python3:win64:
stage: build
tags: ["windows", "64bit", "python3"]
script:
- py -3-64 -V -V
- py -3-64 setup.py bdist_wheel
artifacts: