Skip to content

Instantly share code, notes, and snippets.

View JCloudYu's full-sized avatar

JCloudYu JCloudYu

View GitHub Profile
@JCloudYu
JCloudYu / beacon.py
Created October 1, 2023 02:45 — forked from N3MIS15/beacon.py
micropython iBeacon example
import struct
import ubluetooth as bt
from micropython import const
MANUFACTURER_ID = const(0x004C)
DEVICE_TYPE = const(0x02)
DATA_LENGTH = const(0x15)
BR_EDR_NOT_SUPPORTED = const(0x04)
FLAG_BROADCAST = const(0x01)
MANUFACTURER_DATA = const(0xFF)
@JCloudYu
JCloudYu / webcrypto-examples.md
Created February 9, 2023 11:25 — forked from pedrouid/webcrypto-examples.md
Web Cryptography API Examples
@JCloudYu
JCloudYu / README.md
Created April 15, 2021 09:59 — forked from qti3e/README.md
List of file signatures and mime types based on file extensions
@JCloudYu
JCloudYu / aes.go
Created August 1, 2020 05:19 — forked from willshiao/aes.go
AES 256-CFB in Node.js, Go, and Python
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"fmt"
"io"
@JCloudYu
JCloudYu / daemon.cpp
Created February 29, 2020 18:55 — forked from alexdlaird/daemon.cpp
Useful as a starting point for a C++ based Linux daemon application.
#include <dirent.h>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <sys/stat.h>
#include <syslog.h>
/**
* Author: ChenyChen, JCloudYu
* Create: 2020/01/29
**/
(async()=>{
"use strict";
const START_SIG = "//@export";
const START_SIG_LEN = START_SIG.length;
const END_SIG = "//@endexport";
@JCloudYu
JCloudYu / angularpromise.js
Created January 6, 2019 07:44 — forked from domenic/angularpromise.js
How to subclass a promise
// ES6
class AngularPromise extends Promise {
constructor(executor) {
super((resolve, reject) => {
// before
return executor(resolve, reject);
});
// after
}
@JCloudYu
JCloudYu / keys
Created March 17, 2018 15:39 — forked from miguelmota/ethereum_keys.sh
Generate Ethereum Private key, Public key, and Address using bash and openssl
# Generate the private and public keys
openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > key
# Extract the public key and remove the EC prefix 0x04
cat key | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//' > pub
# Extract the private key and remove the leading zero byte
cat key | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//' > priv
# Generate the hash and take the address part