Skip to content

Instantly share code, notes, and snippets.

View sorz's full-sized avatar
😱
AAHHH

Shell Chen sorz

😱
AAHHH
View GitHub Profile
@sorz
sorz / sendudp.py
Created September 28, 2013 18:21
Send UDP packets from any custom port (using libnet). Used for UDP hole punching on linux servers (when the local UDP port is being used).
#!/usr/bin/env python
#encoding: utf-8
import libnet
from libnet.constants import RAW4, RESOLVE, IPV4_H, UDP_H, IPPROTO_UDP
IFACE = 'wlan2' # Sending via the interface.
def sendto(sport, address):
l = libnet.context(RAW4, IFACE)
Benchmark Run: Tue Jan 05 2016 01:12:34 - 01:40:49
4 CPUs in system; running 1 parallel copy of tests
Dhrystone 2 using register variables 3468309.2 lps (10.0 s, 7 samples)
Double-Precision Whetstone 553.8 MWIPS (9.5 s, 7 samples)
Execl Throughput 419.2 lps (29.8 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 34813.9 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 9742.4 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 111673.9 KBps (30.0 s, 2 samples)
Pipe Throughput 230619.6 lps (10.0 s, 7 samples)
smartctl 6.4 2015-06-04 r4109 [armv7l-linux-4.3.3-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: HGST Travelstar 5K1000
Device Model: HGST HTS541010A9E680
Serial Number:
LU WWN Device Id:
Firmware Version: JA0OA560
User Capacity: 1,000,204,886,016 bytes [1.00 TB]
@sorz
sorz / OkHttpStack.java
Created January 2, 2016 15:28 — forked from bryanstern/OkHttpStack.java
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
#!/usr/bin/env python3
import sys
from videoseeker import VideoSeeker
def main():
seeker = VideoSeeker(sys.argv[1])
for i in range(100):
seeker.seek()
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000b 100 100 062 Pre-fail Always - 0
2 Throughput_Performance 0x0005 100 100 040 Pre-fail Offline - 0
3 Spin_Up_Time 0x0007 253 253 033 Pre-fail Always - 1
4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 34
5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always - 0
7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always - 0
8 Seek_Time_Performance 0x0005 100 100 040 Pre-fail Offline - 0
@sorz
sorz / Board.java
Last active March 21, 2016 10:04
COMP421 Artificial Intelligence, Assignment II, A* Search
import java.util.Arrays;
public class Board implements Comparable<Board> {
public static final byte BLANK = -1;
private byte[] numbers;
private Board father;
private int totalMovement;
private int heuristicCost;
; <<>> DiG 9.10.3-P4 <<>> +trace gmail-smtp-in.l.google.com
;; global options: +cmd
. 3600000 IN NS L.ROOT-SERVERS.NET.
. 3600000 IN NS B.ROOT-SERVERS.NET.
. 3600000 IN NS I.ROOT-SERVERS.NET.
. 3600000 IN NS J.ROOT-SERVERS.NET.
. 3600000 IN NS M.ROOT-SERVERS.NET.
. 3600000 IN NS F.ROOT-SERVERS.NET.
. 3600000 IN NS E.ROOT-SERVERS.NET.
; <<>> DiG 9.10.3-P4 <<>> +trace google-analytics.com
;; global options: +cmd
. 510265 IN NS i.root-servers.net.
. 510265 IN NS k.root-servers.net.
. 510265 IN NS a.root-servers.net.
. 510265 IN NS j.root-servers.net.
. 510265 IN NS d.root-servers.net.
. 510265 IN NS e.root-servers.net.
. 510265 IN NS m.root-servers.net.
# fail2ban filter configuration for Shadowsocks (python).
[Definition]
failregex = can not parse header when handling connection from <HOST>:\d{1,5}$
ignoreregex =