Skip to content

Instantly share code, notes, and snippets.

@caot
caot / Java_Obfuscators
Created November 10, 2014 19:19
Protect Your Java Code — Through Obfuscators And Beyond
Protect Your Java Code — Through Obfuscators And Beyond
http://www.excelsior-usa.com/articles/java-obfuscators.html
@caot
caot / Bouncy Castle Crypto API
Created November 10, 2014 20:30
Bouncy Castle Crypto API
Bouncy Castle Crypto API
https://www.bouncycastle.org/
@caot
caot / jsawk_example
Last active September 15, 2016 20:47
jsawk example
HOST=node:port
auth=`curl -X POST -H "Content-Type: application/json" -d '{"username":"xxxx","password":"yyyy"}' http://hostname/ws/auth-token/ | jsawk 'return this.payload.token'`
curl -sw '\n%{http_code}' -H "Authorization: JWT $auth" -X GET http://hostname/ws/users/{pk}/
curl -sw '\n%{http_code}' -X POST -H "Authorization: JWT $auth" -H "Content-Type: application/json" -d '{"date":"2016-05-05 05:52:00","id":1}' http://$HOST/action/
here is more example:
http://blog.xebia.com/2012/06/27/json-shell-scripting-with-jsawk/
http://www.programering.com/q/MjN1EzMwATA.html
@caot
caot / java byte[] to String
Created August 20, 2015 00:03
java byte[] to String
import javax.xml.bind.DatatypeConverter;
public static String base64EncodedString(byte[] bytes) {
return DatatypeConverter.printBase64Binary(bytes);
}
@caot
caot / Fernflower
Created August 21, 2015 14:04
Java Decompiler -- Fernflower
IntelliJ IDEA is powered by Fernflower decompiler.
https://github.com/caot/fernflower
Here is a list of interesting information:
1. CS243: Program Analysis and Optimization Winter 2014 http://web.stanford.edu/class/cs243/joeq/
@caot
caot / decorator_of_cache_per_user.py
Last active January 12, 2021 20:30
decorator of cache per user in python and django
from django.core.cache import cache as core_cache
'''
refer:
http://stackoverflow.com/questions/20146741/django-per-user-view-caching
https://djangosnippets.org/snippets/2524/
'''
def cache_key(request):
@caot
caot / zlib3.py
Created February 18, 2016 21:57 — forked from glassdfir/zlib3.py
import zlib,sys
def deflate( data ):
zlibbed_data = zlib.compress( data )
#remove byte 0-1(header) and the last four(checksum)
compressed_data = zlibbed_data[2:-4]
return compressed_data
def inflate(compressed_data2):
# -15 for the window buffer will make it ignore headers/footers
zlibbed_data2 = zlib.decompress(compressed_data2, -15)
@caot
caot / extract-pdf-pages.py
Last active June 5, 2016 02:15 — forked from jeetsukumaran/extract-pdf-pages.py
PDF Page Extraction/Selection in Python Using PyPDF
#! /usr/bin/env python
###############################################################################
##
## Copyright 2012 Jeet Sukumaran.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
@caot
caot / build_R.md
Created September 15, 2016 20:40 — forked from mikelove/build_R.md
build R on cluster