Skip to content

Instantly share code, notes, and snippets.

'use strict';
var url = require('url');
var creds = require('./creds.js');
var https = require('https');
var scheme = 'https';
var hostname = 'api.tempo-db.com';
var baseUrl = scheme + '://' + hostname;
#!/bin/bash
fdisk_first() {
p2_start=`fdisk -l /dev/mmcblk0 | grep mmcblk0p2 | awk '{print $2}'`
echo "Found the start point of mmcblk0p2: $p2_start"
fdisk /dev/mmcblk0 << __EOF__ >> /dev/null
d
2
n
p
@theojulienne
theojulienne / class.cpp
Created February 1, 2015 22:35
C++ line-buffered output for Android (for usage in JNI)
class androidbuf: public std::streambuf {
public:
enum { bufsize = 1024 };
androidbuf() { this->setp(0, 0); }
private:
int overflow(int c) {
if (c == traits_type::eof() || c == '\n' || idx == bufsize - 1) {
buffer[idx] = '\0';
idx++;
@theojulienne
theojulienne / Vagrantfile
Created February 7, 2015 06:37
Ubuntu Core + Trusty 64 Dev multi-machine vagrant setup
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "core" do |core|
core.vm.box = "ubuntu/ubuntu-core-devel-amd64"
end
@theojulienne
theojulienne / README.md
Created March 23, 2015 06:47
Fixing WiLink 8 (wl18xx) having MAC address de:ad:be:ef:00:00

If you have a Texas Instruments WiLink 8 (and probably 6) and you get a weird MAC address like:

wlan0     Link encap:Ethernet  HWaddr de:ad:be:ef:00:00

This is likely because the default TI distribution of firmware distributes a file called 'wl1271-nvs.bin' in /lib/firmware/ti-connectivity that overrides the built-in MAC address with this silly address.

To fix, simply:

rm -rf /lib/firmware/ti-connectivity/wl1271-nvs.bin
@theojulienne
theojulienne / gist:af9f52a7ea4110ad8030
Created June 16, 2015 05:27
grub serial console boot (for EFI systems with console redirection)
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal_output serial console
terminal_input serial console
...
append to kernel : console=tty0 console=ttyS0,115200n8
@theojulienne
theojulienne / corruption_finder.py
Created May 23, 2018 23:44
Packet corruption checking via reflected ICMP TTL expired messages
#!/usr/bin/env python3
from scapy.all import IP, ICMP, sr1, TCP, srloop
import sys
import binascii
def main():
destination = '192.30.253.112'
ttl = 5
@theojulienne
theojulienne / traceicmpsoftirq.py
Last active January 11, 2024 12:38
ICMP packet tracer using BCC
#!/usr/bin/python
bpf_text = """
#include <linux/ptrace.h>
#include <linux/sched.h> /* For TASK_COMM_LEN */
#include <linux/icmp.h>
#include <linux/netdevice.h>
struct probe_icmp_data_t
{