Skip to content

Instantly share code, notes, and snippets.

@wyyqyl
wyyqyl / ob.py
Last active September 19, 2020 16:04
ob
#!/usr/bin/env python3
# coding=utf-8
import sys
import re
bdinfo = {}
images = []
def init():
@wyyqyl
wyyqyl / fp.java
Created July 7, 2016 08:51
use fingerprint to encrypt and decrypt message
package com.stephen.demo;
import android.Manifest;
import android.annotation.TargetApi;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Build;
import android.os.CancellationSignal;
private static boolean isWindows() {
return System.getProperties().getProperty("os.name").contains("Windows");
}
public static String exec(String command, long timeout) {
Process ps;
try {
if(isWindows()) {
ps = Runtime.getRuntime().exec("cmd.exe /C " + command);
} else {
@wyyqyl
wyyqyl / shooter.py
Last active November 1, 2016 14:20
Download subtitles from shooter
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import hashlib
import sys
import math
import json
import urllib2
import urllib
# my customized aliases
alias yyupdate="sudo apt-get update && sudo apt-get dist-upgrade -y"
# alipay build bundle
alias kcart='python build_bundle.py /data/workspace/alipay/android_phone_biosecurity/kcart -DproguardSkip=true'
alias bl='python build.py -Dskipcheck=true -DproguardSkip=true -Dandroid.dex.guard=false'
notes=/data/Dropbox/stackedit/work/`date +%Y`/`date +%b`
note=$notes/`date +%d`.md
@wyyqyl
wyyqyl / ddns.py
Last active May 1, 2019 00:35
Setup DDNS with DNSPOD API
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import socket
import fcntl
import struct
import json
import httplib, urllib
params = dict(
@wyyqyl
wyyqyl / private.xml
Created January 26, 2015 17:08
config for Karabiner
<?xml version="1.0"?>
<root>
<item>
<name>F19 to F19</name>
<appendix>(F19 to Hyper (ctrl+shift+cmd+opt) + F19 Only, send escape)</appendix>
<identifier>private.f192f19_escape</identifier>
<autogen>
--KeyOverlaidModifier--
KeyCode::F19,
KeyCode::COMMAND_L,
@wyyqyl
wyyqyl / jsoncpp_test_field.cpp
Created December 19, 2014 14:34
test if val["1"]["2"]["3"] is bool
Json::value val;
val = val["1"];
if (val.isNull() || !val.isObject()) {
return false;
}
val = val["2"];
if (val.isNull() || !val.isObject()) {
return false;
}
val = val["3"];
@wyyqyl
wyyqyl / port_occupation.cpp
Created December 18, 2014 14:14
Occupy specific ports
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <websocketpp/config/asio_no_tls.hpp>
#include <websocketpp/server.hpp>
#include <boost/shared_array.hpp>
#include <iostream>
typedef websocketpp::server<websocketpp::config::asio> server;
@wyyqyl
wyyqyl / gencert.c
Created December 6, 2014 09:15
Generate cert with openssl
/* This utility generates a self-signed X.509 certificate with an embedded
* DNSSEC chain.
*
* Usage: ./gencert <PEM private key> <DNSSEC chain file> > cert.pem
*/
#include <stdio.h>
#include <openssl/asn1.h>
#include <openssl/bio.h>