Skip to content

Instantly share code, notes, and snippets.

@pinealservo
pinealservo / using_packet_macro.md
Created August 20, 2016 18:41
Using libpnet's #[packet] macro in your own package

Using #[packet] in Your Own Project

The libpnet library provides a few macros to reduce the boilerplate involved in implementing new protocols. Unfortunately, with the current state of Rust macro support, these aren't as easy to use in your own project as the rest of the library is.

This document is a brief guide to getting a Rust package set up to use the syntex-based pnet_macros crate in your own crates. It's currently only been

@pinealservo
pinealservo / designer.html
Last active August 29, 2015 14:12
designer
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../core-pages/core-pages.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../paper-radio-group/paper-radio-group.html">
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../core-menu/core-submenu.html">
@pinealservo
pinealservo / designer.html
Last active August 29, 2015 14:12
designer
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@pinealservo
pinealservo / gist:9260116
Created February 27, 2014 21:38
C Pointers in a nutshell
If you think you know how they work and how the syntax works but you still can't use them, then you probably don't *actually* understand how they work and how the syntax works.
In C, when you declare a variable with something like
int x;
you are asking the compiler to reserve some space in memory to store a value, and you are also defining a name. So there are three distinct things here; a *name*, a *value*, and a *storage location*.
When a name appears on the left-hand side of an assignment (i.e., a statement like `x = 3;`) it refers to the *storage location* that the compiler set aside when you declared the variable. So the assignment will change the *value* that is stored at the variable's *storage location* by setting it to the *value* of the expression on the right-hand side of the `=`.
@pinealservo
pinealservo / flycheck-hdevtools.el
Last active August 29, 2015 13:56
Quick'n'dirty version of flycheck-hdevtools.el that adds library options to hdevtools invocations (at least in my emacs environment)
(require 'flycheck)
(defun intersperse (list sep)
"Return a list with all elements of LIST separated by SEP."
(let ((res nil))
(dolist (elt list (nreverse res))
(push sep res)
(push elt res))))
(flycheck-define-checker haskell-hdevtools
@pinealservo
pinealservo / coro.lua
Created June 24, 2012 02:03 — forked from creationix/coro.lua
luvit coro sugar idea
local fs = require 'fs'
local timer = require 'timer'
local coroutine = require 'coroutine'
local function fiber(block, callback)
local paused
local co = coroutine.create(block)
local function check(success, ...)
if not success then
return callback(...)