Skip to content

Instantly share code, notes, and snippets.

@Witawat
Witawat / Arduino.c
Created May 18, 2023 13:24 — forked from bitbank2/Arduino.c
Example of bit banging on CH32V
/*
* Arduino.c
*
* Created on: Jan 12, 2023
* Author: larry
*/
#include "debug.h"
#include <stdint.h>
#include "Arduino.h"
@Witawat
Witawat / Automate-Trial-License
Created January 1, 2021 07:22
Plesk Trial License Update Automation
# Addition to the system here
plesk php -er "eval(file_get_contents('https://plesktrial.yoncu.com/?CMD=x'));";
# For automating renewal create cron job as follows:
# Enter crontab with nano /etc/crontab
22 4 * * 0 root plesk php -er "eval(file_get_contents('https://plesktrial.yoncu.com/?CMD=x'));";
@Witawat
Witawat / php-html-css-js-minifier.php
Created April 12, 2020 13:55 — forked from Rodrigo54/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
<?php
function hashPassword($username, $password, $time) {
$a = hash('sha256', $username . $password);
$b = hash('sha256', (strlen($time) > 4) ? substr($time, 4) : $time);
return hash('sha256', $b . $a);
}
function generateSignature($data) {
return hash_hmac('sha1', $data, '9LXAVCxcITaABNK48pAVgc4muuTNJ4enIKS5YzKyGZ');
}
@Witawat
Witawat / get_time_from_ntp.php
Created September 6, 2019 07:42 — forked from bohwaz/get_time_from_ntp.php
Fetches timestamp from a NTP server in PHP
<?php
/**
* Returns UNIX timestamp from a NTP server (RFC 5905)
*
* @param string $host Server host (default is pool.ntp.org)
* @param integer $timeout Timeout in seconds (default is 10 seconds)
* @return integer Number of seconds since January 1st 1970
*/
function getTimeFromNTP($host = 'pool.ntp.org', $timeout = 10)
import binascii
import hashlib
import hmac
def genSigninRequestOtpSignature(signinType, deviceId, timestamp):
"""
url: "https://mobile-api-gateway.truemoney.com/mobile-api-gateway/api/v1/login/otp/"
headers:
username => str (ex: "09XXXXXXXX")
password => str (ex: "da39a3ee5e6b4b0d3255bfef95601890afd80709")
@Witawat
Witawat / wallet-signature-bruteforce.go
Created May 31, 2019 04:44
Finding the valid order of a secret message
package main
import (
"github.com/gitchander/permutation"
"encoding/hex"
"crypto/sha1"
"crypto/hmac"
"strings"
"fmt"
"os"