Skip to content

Instantly share code, notes, and snippets.

@austinmarton
austinmarton / recvRawEth.c
Created Jun 3, 2012
Receive raw Ethernet frames in Linux
View recvRawEth.c
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/ip.h>
@austinmarton
austinmarton / sendRawEth.c
Created Feb 27, 2012
Send a raw Ethernet frame in Linux
View sendRawEth.c
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <stdio.h>
View simple_bash_loop.sh
#!/bin/bash
for i in {0..20..2} ; do echo "i=$i"; done
# ^ ^ ^
# | | |
# start --' | |
# end -------' |
# increment -----'
@austinmarton
austinmarton / linux_timerfd_example.c
Created Jul 13, 2012
Linux file descriptor timers example
View linux_timerfd_example.c
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
@austinmarton
austinmarton / solib-deps.sh
Last active Nov 24, 2016 — forked from toojays/solib-deps.sh
Given a shared library (or executable) print the symbols it uses from libraries it directly depends on.
View solib-deps.sh
#!/bin/bash
set -e
# Given a shared library, print the symbols it uses from other libraries it
# directly depends on.
LIB=$1
# Use readelf rather than ldd here to only get direct dependencies.
DEPS=$(readelf -d $LIB | awk '/Shared library:/{ print substr($5, 2, length($5) - 2) }')
You can’t perform that action at this time.