Skip to content

Instantly share code, notes, and snippets.

View luftreich's full-sized avatar

luftreich

  • MXB.Ltd
  • Shenzhen.China
View GitHub Profile
#!/usr/bin/python
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('0.0.0.0', 6000))
while True:
data, addr = s.recvfrom(1024)
s.sendto(str(addr[1]), addr)
@luftreich
luftreich / docker-gitlab.md
Created March 24, 2017 06:44 — forked from ouyangzhiping/docker-gitlab.md
docker-gitlab部署

docker用来隔离应用还是很方便的,一来本身的操作较为简单,二来资源占用也比虚拟机要小得多,三来也较为安全,因为像数据库这样的应用不会再全局暴露端口,同时应用间的通信通过加密和端口转发,更加安全。

Gitlab是目前比较流行的开源类Github代码管理平台。Gitlab使用Rails开发,使用PostgreSQL或MySQL数据库,Redis做缓存。一般自己搭建私有代码仓库,Gitlab通常是首选。这里简单介绍一下dockerized Gitlab。

Gitlab的docker镜像早已有人做好了,并且维护相当不错。大家可以前往其GitHub仓库了解该镜像的情况。官方repo的readme中已经有详细的安装配置方案,这里我简单的梳理一下部署流程。

安装Docker

这里以Ubuntu 14.04发行版为例,在bash中输入一下命令安装最新的docker:

@luftreich
luftreich / gfw_and_cannon_traceroute.py
Created March 13, 2017 06:54 — forked from jim3ma/gfw_and_cannon_traceroute.py
A Tool for Tracerouting the GC and GFW
#!/usr/bin/env python
import time
import threading
from scapy.all import *
import sys
import socket
maxhop = 25
@luftreich
luftreich / netfwd.go
Created December 16, 2016 09:21 — forked from mike-zhang/netfwd.go
Simple GO TCP proxy
// can be run in go 1.0.3
// build : go build netfwd.go
package main
import (
"net"
"fmt"
"io"
"os"
)
@luftreich
luftreich / tc.sh
Created September 7, 2016 02:32 — forked from jedy/tc.sh
tc带宽控制
#!/bin/bash
#脚本文件名: tc2
#########################################################################################
#用TC(Traffic Control)解决ADSL宽带速度技术 Ver. 1.0 by KindGeorge 2004.12.27 #
#########################################################################################
#此脚本经过实验通过,更多的信息请参阅http://lartc.org
#tc+iptables+HTB+SFQ
#
#一.什么是ADSL? ADSL(Asymmetric Digital Subscriber Loop,非对称数字用户环路)
#用最简单的话的讲,就是采用上行和下行不对等带宽的基于ATM的技术.
@luftreich
luftreich / install_wifi_access_point.sh
Created August 5, 2016 06:52 — forked from dashohoxha/install_wifi_access_point.sh
How to setup a Wifi Access Point on Ubuntu 12.04 (or its derivatives).
#!/bin/bash
### Setup a wifi Access Point on Ubuntu 12.04 (or its derivatives).
### make sure that this script is executed from root
if [ $(whoami) != 'root' ]
then
echo "
This script should be executed as root or with sudo:
sudo $0
"
@luftreich
luftreich / wr703n-openwrt.md
Created July 30, 2016 11:52 — forked from ninehills/wr703n-openwrt.md
WR703N OpenWrt 配置流程

WR703N OpenWrt 配置流程

下载安装

访问WR703N在OpenWrt的[Wiki页][wr703n-openwrt],然后在Flashing一节中找到下载链接:[squashfs-factory.bin][flash.bin],下载后别忘了[比对md5][md5sum]。[1]

进入路由器管理界面,出厂配置为http://192.168.1.1,用户名和密码均为admin,然后进入固件更新,选择下载的文件,然后更新。

@luftreich
luftreich / 在线预览本地图片.html
Created July 29, 2016 03:59 — forked from yangsaipp/在线预览本地图片.html
在线预览本地图片,html5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>本地图片在线预览</title>
</head>
<body>
<script type="text/javascript">
var result=document.getElementById("result");
var file=document.getElementById("file");