Skip to content

Instantly share code, notes, and snippets.

View c2h2's full-sized avatar

Yiling Cao c2h2

View GitHub Profile
@c2h2
c2h2 / arduino_esp8266_dht11_https_send.c
Last active February 14, 2023 16:10
arduino_esp8266_dht11_https_send.c
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
#include <WiFiClientSecureBearSSL.h>
#include "DHT.h"
DHT dht2(2, DHT11);
const char* ssid = "ssid";
const char* password = "xxxx";
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
#include "DHT.h"
DHT dht2(2,DHT11);
const char* ssid = "ssid";
const char* password = "xxxxxx";
@c2h2
c2h2 / arduino_esp8266_wifi-client_web-server_pin_ctl.c
Last active January 13, 2023 16:32
eso8266 connects home wifi router and accepts http request to control pins, for home ventilation automation
/*
arduino_esp8266_wifi-client_web-server_pin_ctl.c
compiled on arduino 2.0.4 and using ESP-01 8pin module and a relay.
WiFi Client, HTTP Web Server, to control 2 pins and relays.
*/
#include <ESP8266WiFi.h>
@c2h2
c2h2 / combine_aiports.py
Created January 11, 2023 02:59
combine_aiports.py
import urllib.request
import base64
import json
import ssl
url="https://jmssub.net/" #change to your url
content = urllib.request.urlopen(url).read().strip()
servers_sub = base64.b64decode(content).decode()
output = []
@c2h2
c2h2 / ping_for_awhile.sh
Last active September 19, 2022 05:58
ping_for_awhile.sh
#!/bin/bash
ts=`date '+%Y%m%d-%H%M%S'`
fn=${ts}_pingresults.txt
function ping_for_awhile(){
myip=`curl -s --insecure https://f.g77k.com/ip.php`
srvtime=`curl -s --insecure https://f.g77k.com/time.php`
date | tee $fn
@c2h2
c2h2 / get_libgen_scimag.py
Created July 10, 2022 11:47
get libgen scimag torrents python3
import urllib.request
import requests
import lxml.html
import os
from urllib.parse import urlparse
target="http://libgen.rs/scimag/repository_torrent/"
allowed_exts=[".torrent"]
content = ""
@c2h2
c2h2 / goroutine_limiter_example.go
Created April 30, 2022 08:50
limit number of goroutine concurrently running.
package main
import (
"fmt"
"strconv"
"sync"
"time"
)
@c2h2
c2h2 / solve_wordly.py
Created February 6, 2022 17:34
solve_wordly.py,
import sys
f = open("allowed_words.txt", "r")
#f = open("possible_words.txt", "r")
#"allowed_words.txt" from https://github.com/3b1b/videos/tree/master/_2022/wordle_data
content = f.read()
words = content.split("\n")
if len(sys.argv)!=4:
@c2h2
c2h2 / snapclient.desktop
Created February 3, 2022 12:55
autostart snapclient
[Desktop Entry]
Name=Snapclient
Type=Application
Exec=/usr/bin/snapclient -h 192.168.2.222
Terminal=false
#add to /etc/xdg/autostart/snapclient.desktop
@c2h2
c2h2 / process_sony_jpgs.py
Created October 1, 2021 15:31
Create smaller jpgs for XL jpgs, for my sony alpha A7R4
import os
import glob
import subprocess
# set search path and glob for files
# here we want to look for csv files in the input directory
path = '.'
files = glob.glob(path + '/*.JPG')
def create_resize(f):