Skip to content

Instantly share code, notes, and snippets.

@cod1ingcoding
cod1ingcoding / get-ip-mac-pairs-in-lan.sh
Created Sep 5, 2019
get all ip mac pairs in current lan
View get-ip-mac-pairs-in-lan.sh
#!/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 Jul 11, 2019 — forked from povilasb/main.py
TUN/TAP in python
View main.py
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
View Doctrine_Entity_One_to_Many.php
<?php
// Eorder.php
use Doctrine\Common\Collections\ArrayCollection;
/**
* @Entity @Table(name="e_orders", options={"collate"="utf8_general_ci"})
*/
class Eorder
{
/**
* @var integer
View Doctrine_Entity_ManyToMany_directional.php
<?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")
View Doctrine_Entity_ManyToMany_unidirectional.php
<?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 Aug 23, 2017 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
View User.php
<?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 Mar 28, 2017 — forked from ayang/dropbox_proxy.py
Dropbox proxy behind the GFW of China
View dropbox_proxy.py
#!/usr/bin/env python
import re
import tornado.ioloop
import tornado.web
from tornado import httpclient
class MainHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
View getencoding.php
<?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)
*/