Skip to content

Instantly share code, notes, and snippets.

const diff = require('deep-diff').diff;
async function main(groupId) {
let res = await fetch("https://www.duolingo.com/2017-06-30/sessions", {
"credentials": "include",
"headers": {
"Content-Type": "application/json; charset=UTF-8",
"Authorization": "Bearer Put your bearer ode here"
},
body: JSON.stringify({
@Heinrich-XIAO
Heinrich-XIAO / notification.cpp
Last active September 10, 2024 23:52
A simple c++ script to send a notification cross-platform.
#include <iostream>
#include <string>
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#elif defined(__APPLE__)
#include <unistd.h>
#include <sys/wait.h>
#elif defined(__linux__)
#include <unistd.h>
# Scrapes duolingo for all users
import requests
from datetime import datetime, timezone
def date(epoch_time):
date_obj = datetime.fromtimestamp(epoch_time, timezone.utc)
# Format the datetime object to dd/mm/yy hh:mm:ss format
formatted_date = date_obj.strftime('%d/%m/%y %H:%M:%S')
@Heinrich-XIAO
Heinrich-XIAO / music.hs
Created February 6, 2024 12:55
Music Player
import System.Process
import Control.Concurrent
import System.Directory
import System.FilePath ((</>))
printFiles :: [String] -> IO()
printFiles (x:xs) = do
putStrLn x
printFiles xs
@Heinrich-XIAO
Heinrich-XIAO / unsubscribe.html
Created January 14, 2024 15:21
Unsubscribe to our newsletter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
margin: 0;
overflow: hidden;
}
@Heinrich-XIAO
Heinrich-XIAO / carcharger.py
Created December 31, 2023 22:05
Code to charge my car with a raspberry pi pico
import network
import socket
import time
import struct
import urequests
import BlynkLib
import network
import machine
import gc
@Heinrich-XIAO
Heinrich-XIAO / elevator.py
Created May 31, 2022 14:30
Some micropython code for an elevator
from machine import PWM, Pin
from utime import sleep, sleep_us, ticks_ms
class StepperMotor:
def __init__(self, ins):
self.ins = [Pin(ins[0], Pin.OUT), Pin(ins[1], Pin.OUT), Pin(ins[2], Pin.OUT), Pin(ins[3], Pin.OUT)]
def step(self, direction):
r = [3, 2, 1, 0] if (not direction) else [0, 1, 2, 3]
for i in r: