Skip to content

Instantly share code, notes, and snippets.

View cynron's full-sized avatar

Wang Xinyong cynron

View GitHub Profile
var dgram = require('dgram');
var socket = dgram.createSocket('udp4');
process.on('uncaughtException', function(e) {
console.log(e);
});
socket.bind(7400, '0.0.0.0', function() {
socket.addMembership('239.255.0.1', '0.0.0.0');
socket.setMulticastLoopback(true);
@cynron
cynron / pipe_s
Created April 16, 2015 06:06
pipe_create
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#ifdef _WIN32
#include <netinet/in.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <net/if.h>
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
# setting up irq affinity according to /proc/interrupts
# 2008-11-25 Robert Olsson
# 2009-02-19 updated by Jesse Brandeburg
#
# > Dave Miller:
# (To get consistent naming in /proc/interrups)
# I would suggest that people use something like:
# char buf[IFNAMSIZ+6];
#
# sprintf(buf, "%s-%s-%d",
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <asm/types.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <netinet/in.h>
@cynron
cynron / git-branch-simplify.md
Created May 4, 2017 12:13 — forked from datagrok/git-branch-simplify.md
How to simplify the graph produced by git log --graph

Ideas for improvements to git log --graph

I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.

Make the graph for --topo-order less wiggly

Imagine a long-running development branch periodically merges from master. The git log --graph --all --topo-order is not as simple as it could be, as of git version 1.7.10.4.

It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.

@cynron
cynron / ovs-cheat.md
Created May 20, 2018 15:45 — forked from djoreilly/ovs-cheat.md
OVS cheat sheet

DB

ovs-vsctl list interface
ovs-vsctl --columns=ofport,name list Interface
ovs-vsctl --columns=ofport,name --format=table list Interface
ovs-vsctl --format=table --columns=name,mac_in_use find Interface name=br-dpdk1
ovs-vsctl get interface vhub656c3cb-23 name

ovs-vsctl set port vlan1729 tag=1729
ovs-vsctl get port vlan1729 tag
@cynron
cynron / ovs-cheat.md
Created May 20, 2018 15:45 — forked from djoreilly/ovs-cheat.md
OVS cheat sheet

DB

ovs-vsctl list interface
ovs-vsctl --columns=ofport,name list Interface
ovs-vsctl --columns=ofport,name --format=table list Interface
ovs-vsctl --format=table --columns=name,mac_in_use find Interface name=br-dpdk1
ovs-vsctl get interface vhub656c3cb-23 name

ovs-vsctl set port vlan1729 tag=1729
ovs-vsctl get port vlan1729 tag