Skip to content

Instantly share code, notes, and snippets.

View kaichiachen's full-sized avatar

Kaichia Chen kaichiachen

View GitHub Profile
@kaichiachen
kaichiachen / tcp.py
Created September 17, 2020 01:50
Show how three-way handshake(connection) and four-way handshake(termination) works from RAW packets
import logging
import argparse
import socket
import sys
import binascii
import struct
import array
import time
logging.basicConfig(level=logging.INFO,format='%(asctime)s %(levelname)-5s %(message)s', datefmt='%Y-%m-%d %I:%M:%S %p')
@kaichiachen
kaichiachen / labelmap_person.prototxt
Last active September 27, 2018 10:01
labelmap_person.prototxt
item {
name: "none_of_the_above"
label: 0
display_name: "background"
}
item {
name: "person"
label: 1
display_name: "person"
}
cur_dir=$(cd $( dirname ${BASH_SOURCE[0]} ) && pwd )
root_dir="/workspace"
cd $root_dir
redo=1
data_root_dir="/workspace/mydata/"
dataset_name="result"
mapfile="/workspace/data/VOC0712/labelmap_person.prototxt"
anno_type="detection"
#!/bin/bash
root_dir="/workspace/mydata"
sub_dir="ImageSets/Main"
bash_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
for dataset in train test
do
dst_file=$bash_dir/$dataset.txt
if [ -f $dst_file ]
then
c.NotebookApp.ip = '*'
c.NotebookApp.password = 'sha1:931d7c84b41e:fe983820617e2674b47a068bae46ae1d9fc85c35'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
package com.vm5.adplay;
/**
* Created by andy on 3/4/16.
*/
public class viewcontroller {
void onCreate(){
Request object = new Request();
object.request();
package com.vm5.adplay;
import com.ext.loopj.android.http.AsyncHttpClient;
import com.ext.loopj.android.http.JsonHttpResponseHandler;
import org.apache.http.Header;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@kaichiachen
kaichiachen / gist:9580a0c556f51431b9db
Created December 15, 2015 17:03
question 5 - tableViewCell
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell : UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("cellID")! as UITableViewCell
if(cell_== nil)
{
cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cellID")
}
cell.textLabel.text = array[array.count - indexPath.row - 1]
return cell;
}
@kaichiachen
kaichiachen / gist:cd6a88783fa094e06d26
Created December 15, 2015 17:01
question 6 - autolayout
import UIKit
class ViewController: UIViewController {
let brown:UIView = {
let view = UIView(frame: CGRectZero)
view.backgroundColor = UIColor.brownColor()
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()