Skip to content

Instantly share code, notes, and snippets.

hexString = ""
hexString = hexString[2:-2]
hexString = hexString.replace("7d01", "7d")
hexString = hexString.replace("7d02", "7e")
payload = bytearray.fromhex(hexString)
@pinetum
pinetum / rsa.py
Last active October 15, 2020 01:39
tp-link TL-MR6400 4g router SMS reader
__all__ = ['rsa']
# Don't look below, you will not understand this Python code :) I don't.
# generated by js2py
from js2py.pyjs import *
# setting scope
var = Scope( JS_BUILTINS )
set_global_object(var)
@pinetum
pinetum / mi6_nfc_emulator.sh
Created April 1, 2018 12:58
change mi6 nfc id
#!/system/bin/sh
su -c "
echo \"enter /system/etc\" &&\
cd /system/etc &&\
echo \"mount /system rw\" &&\
mount -o rw,remount /system &&\
echo \"patch nfc id\" &&\
sed -i -e 's/33, 04, 01, 02, 03, 04,/33, 04, AA, AA, AA, AA,/g' libnfc-nxp.conf &&\
echo \"mount /system ro\" &&\
mount -o ro,remount /system &&\
@pinetum
pinetum / getLabelContourMask
Created July 25, 2016 08:43
getLabelContourMask
void CSID::getLabelContourMask(cv::Mat &mask, bool _thick_line)
{
// default width
int line_width = 2;
if ( !_thick_line ) line_width = 1;
int width = m_matData.cols;
int height = m_matData.rows;
mask.create(height, width, CV_8UC1 );
@pinetum
pinetum / drive.py
Created July 12, 2016 15:43 — forked from basuke/drive.py
Create the GPX file from origin and destination using the GoogleMap Direction API. You can use this output for simulate the location apps in Xcode.
#
# python drive.py "origin" ["waypoint" ... ] "destination"
#
# i.e. python drive.py "Union Square, San Francisco" "Ferry Building, San Francisco" 'Bay Bridge' SFO
import sys, json, urllib2, md5, os.path, pprint
from math import radians, sin, cos, atan2, pow, sqrt
from urllib import quote_plus
from xml.sax.saxutils import escape
from optparse import OptionParser
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
typedef struct _lbheader{
unsigned short identifier; // 0x0000
unsigned int filesize; // 0x0002
unsigned int reserved; // 0x0006
# 5550
# 1978
# 5551
# 1979
# 5552
# 1980
# 5553
# 1981
# 5554
# 1982
@pinetum
pinetum / read floating point number in binary file.R
Last active April 21, 2020 10:38
Read binary file in R (4byte float point)
path_binary_file <- "~/Dropbox/元智課程資料/研究所課程/資料探勘/VQ/COL.sil"
n_dimension <- 26
n_element_byte <- 4
#------read file-----
#create file connection
zz <- file(path_binary_file, "rb")
# calculate number of element bt file size
n_total_element <- file.info(path_binary_file)$size/n_element_byte