Skip to content

Instantly share code, notes, and snippets.

View Luavis's full-sized avatar
🐈
meow~

Luavis Luavis

🐈
meow~
View GitHub Profile
import ctypes
from ctypes import CDLL, CFUNCTYPE, c_int, c_void_p, c_char_p
libc = CDLL('libc.so.6')
CSIGNAL = 0x000000ff
CLONE_VM = 0x00000100
CLONE_FS = 0x00000200
CLONE_FILES = 0x00000400
CLONE_SIGHAND = 0x00000800
We can't make this file beautiful and searchable because it's too large.
"1.0.0.0","1.0.0.255","16777216","16777471","AU","Australia"
"1.0.1.0","1.0.3.255","16777472","16778239","CN","China"
"1.0.4.0","1.0.7.255","16778240","16779263","AU","Australia"
"1.0.8.0","1.0.15.255","16779264","16781311","CN","China"
"1.0.16.0","1.0.31.255","16781312","16785407","JP","Japan"
"1.0.32.0","1.0.63.255","16785408","16793599","CN","China"
"1.0.64.0","1.0.127.255","16793600","16809983","JP","Japan"
"1.0.128.0","1.0.255.255","16809984","16842751","TH","Thailand"
"1.1.0.0","1.1.0.255","16842752","16843007","CN","China"
"1.1.1.0","1.1.1.255","16843008","16843263","AU","Australia"
#!/bin/bash
DATA=./GeoIPCountryWhois.csv
IPT=/sbin/iptables
for IPRANGE in `egrep "China" $DATA | cut -d, -f1,2 | sed -e 's/"//g' | sed -e 's/,/-/g'`
do
$IPT -A INPUT -p all -m iprange --src-range $IPRANGE -j DROP
done
@Luavis
Luavis / ie10-viewport-bug-workaround.js
Created April 25, 2015 06:27
ie10-viewport-bug-workaround.js
/*!
* IE10 viewport hack for Surface/desktop Windows 8 bug
* Copyright 2014 Twitter, Inc.
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see http://creativecommons.org/licenses/by/3.0/.
*/
// See the Getting Started docs for more information:
// http://getbootstrap.com/getting-started/#support-ie10-width
@Luavis
Luavis / app.py
Created June 22, 2020 03:39
Java decompiler
#!/usr/bin/env python
import struct
import re
from io import BytesIO
import sys
from code_attribute import read_code_attribute
uint8 = lambda x: struct.unpack('>B', x)[0]
uint16 = lambda x: struct.unpack('>H', x)[0]
int32 = lambda x: struct.unpack('>l', x)[0]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.table-wrap {
/* width: 300px; */
height: 300px;
package benchmark;
public class GCBenchmark {
private static class MemoryAllocator {
private int[] buffer;
private MemoryAllocator(int size) {
this.buffer = new int[size];
}
@Luavis
Luavis / install-arch.sh
Created May 2, 2019 02:42 — forked from akhenakh/install-arch.sh
Install Arch Linux on OSX with xhyve
#!/bin/bash
#
# Usage
# install-arch.sh ./archlinux-2018.11.01-x86_64.iso
# first you neeed to patch xhyve with this
# index 61aeebb..39a9c4b 100644
# --- a/src/firmware/kexec.c
# +++ b/src/firmware/kexec.c
# @@ -185,6 +185,7 @@ kexec_load_ramdisk(char *path) {
#!/usr/bin/env python
import os
import argparse
from multiprocessing import Queue, Process
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
def worker(q):
options = Options()
@Luavis
Luavis / jumin.js
Created March 26, 2014 14:28
대한민국 주민번호 확인 알고리즘
"use strict";
var input = '13자리의 주민번호 - 없이';
var mul = [2,3,4,5,6,7,8,9,2,3,4,5];
var sum = 0;
for(var i =0; i < mul.length; i++) {
var digit = parseInt(input[i]);
sum += digit * mul[i];
}