Skip to content

Instantly share code, notes, and snippets.

@cod1ingcoding
cod1ingcoding / get-ip-mac-pairs-in-lan.sh
Created September 5, 2019 00:38
get all ip mac pairs in current lan
#!/bin/bash
ip_prefix=192.168.1
for((i = 1; i < 255; i++))
do
ip=${ip_prefix}.${i}
ping $ip -c 2
arp -a | grep "(${ip})" | grep -E [0-9a-f]{2}:[0-9a-f]{2} >> ~/ip-mac-pairs.txt
done
@cod1ingcoding
cod1ingcoding / main.py
Created July 11, 2019 05:36 — forked from povilasb/main.py
TUN/TAP in python
import os
from fcntl import ioctl
import struct
import time
import random
from threading import Thread
from pyroute2 import IPRoute
from pypacker.layer3.ip import IP
from pypacker.layer3.ip6 import IP6
<?php
// Eorder.php
use Doctrine\Common\Collections\ArrayCollection;
/**
* @Entity @Table(name="e_orders", options={"collate"="utf8_general_ci"})
*/
class Eorder
{
/**
* @var integer
<?php
// Epost.php
use Doctrine\Common\Collections\ArrayCollection;
/**
* @Entity @Table(name="e_post", options={"collate"="utf8_general_ci"})
*/
class Epost
{
/**
* @Id @GeneratedValue @Column(type="integer")
<?php
// Epost.php
use Doctrine\Common\Collections\ArrayCollection;
/**
* @Entity @Table(name="e_post", options={"collate"="utf8_general_ci"})
*/
class Epost
{
/**
* @Id @GeneratedValue @Column(type="integer")
@cod1ingcoding
cod1ingcoding / User.php
Created August 23, 2017 01:49 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
@cod1ingcoding
cod1ingcoding / dropbox_proxy.py
Created March 28, 2017 15:36 — forked from ayang/dropbox_proxy.py
Dropbox proxy behind the GFW of China
#!/usr/bin/env python
import re
import tornado.ioloop
import tornado.web
from tornado import httpclient
class MainHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
<?php
/**
* function: 测试字符串编码(utf-8/gbk/ascii)
* author: 华仔 2010/12/27
* params:
* @s:string 要测试的文本
* @priencoding:string 当非acsii字节太少(少于3),且可能是两种编码时,优先使用的编码(一般是gbk)
* @reserveascii:boolean 如果为ascii,是否设置为优先编码
* return:string 字符串编码(utf-8/gbk/ascii)
*/