Skip to content

Instantly share code, notes, and snippets.

View lotusirous's full-sized avatar
💭
for { Learn() }

Kha Nguyen lotusirous

💭
for { Learn() }
View GitHub Profile
rm(list=ls())
data = read.csv('weisberg_fuel.csv',header=TRUE)
X1 <- data$TAX # Tax
X2 <- data$DLIC
X3 <- data$INC
X4 <- data$ROAD
Y <- data$FUEL
@lotusirous
lotusirous / date_range.py
Last active November 30, 2016 12:45
A python script for generate daily and monthly date in range
import datetime
from dateutil import relativedelta
def daterange(start, end, freq="daily"):
if freq == "daily":
number_of_days = int ((end_date - start_date).days) +1
for n in range(number_of_days):
yield start_date + datetime.timedelta(n)
return
@lotusirous
lotusirous / xss_jquery.html
Last active August 23, 2022 16:53
Example of XSS vulnerability on Jquery 1.4.2
<html>
<head>
<meta charset="utf-8">
<title>XSS Reflected - Jquery 1.4.2 </title>
<script src="http://www.tcs.com.vn/mysite/javascript/jquery-1.4.2.min.js"></script>
<script>
$(function() {
$('#users').each(function() {
var select = $(this);
var option = select.children('option').first();
@lotusirous
lotusirous / auto_click.js
Last active May 2, 2017 01:09
JavaScript auto click
var robot = require("robotjs");
var mouse = robot.getMousePos();
function click(loc){
var mouse = robot.getMousePos();
robot.moveMouse(loc.x,loc.y);
//Left click!
robot.mouseClick();
@lotusirous
lotusirous / HttpExample.java
Created May 1, 2017 02:45
A Java Example HTTP request with JSON
package a10vulnerability;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.FileNotFoundException;
import org.json.JSONArray;
import org.json.JSONTokener;
@lotusirous
lotusirous / watermark_removing.py
Created May 2, 2017 00:49
Remove watermark in pdf books
import binascii
from optparse import OptionParser
watermark_char = "".join("34 39 30 39 20 30 20 52".split())
unchar_watermark = "".join("00 00 00 00 20 30 20 52".split())
watermark_link = "".join("2F 52 65 63 74 5B 32 36 36 20 35 39 20 33 37 31 20 37 33 5D 20 2F 42 53 20 3C 3C 2F 54 79 70 65 2F 42 6F 72 64 65 72 20 3E 3E 20 2F 42 6F 72 64 65 72 5B 30 20 30 20 30 5D 20 2F 43 5B 30 20 30 20 30 5D 20 2F 41 3C 3C 2F 53 2F 55 52 49 2F 55 52 49 28 68 74 74 70 3A 2F 2F 77 77 77 2E 61 6C 6C 69 74 65 62 6F 6F 6B 73 2E 6F 72 67 29".split())
def remove_watermark(path):
bin_pdf = ""
@lotusirous
lotusirous / README.md
Last active May 2, 2017 00:54
mitmproxy for modifying js on-the-fly

ProxyJS

NodeJS proxy with JS intrumentation

Requirements

modules:

  • python mitmproxy
  • esprima
  • cheerio

Features

@lotusirous
lotusirous / urllib2_example.py
Last active June 30, 2017 16:21
Example of urllib2 with gzip decompression
from StringIO import StringIO
import requests
import urllib2
import gzip
headers = {
'Host':'pkget.com',
'Connection':'keep-alive',
'Accept':'application/json, text/javascript, */*; q=0.01',
'X-Requested-With':'XMLHttpRequest',
@lotusirous
lotusirous / build-tensorflow-from-source.md
Created September 10, 2017 13:14 — forked from Brainiarc7/build-tensorflow-from-source.md
Build Tensorflow from source, for better performance

Building Tensorflow from source on Linux for maximum performance:

TensorFlow is now distributed under an Apache v2 open source license on GitHub.

Step 1. Install NVIDIA CUDA:

To use TensorFlow with NVIDIA GPUs, the first step is to install the CUDA Toolkit.

Step 2. Install NVIDIA cuDNN:

@lotusirous
lotusirous / compile_tensorflow_serving.sh
Created September 12, 2017 07:10 — forked from jorgemf/compile_tensorflow_serving.sh
Compile TensorFlow Serving with CUDA support (July 2017)
#!/bin/bash
TENSORFLOW_COMMIT=bef67104a0da34b6cac0d801168f2e42a1ab7921 # July 7, 2017
TENSORFLOW_SERVING_COMMIT=15cb2ace25493161d47b0d76047b3997d371e59c # July 14, 2017
MODELS_COMMIT=3d97b007cdb2c73f23daf9141437796095436c22 # July 7, 2017
if [ -z $TENSORFLOW_SERVING_REPO_PATH ]; then
TENSORFLOW_SERVING_REPO_PATH="serving"
fi