Skip to content

Instantly share code, notes, and snippets.

barriosj@ThinkPad-W530 [02:13:51 PM] [~/hobbes/build] [hc *]
-> % gcc ./../out.s -L../lib/hobbes/ -lhobbes
/tmp/cc7Ux2hL.o: In function `bvPrintT':
out.ll:(.text+0x8ee): undefined reference to `putStr'
/tmp/cc7Ux2hL.o: In function `runLongDFA':
out.ll:(.text+0xccc): undefined reference to `.failvarmatch'
/tmp/cc7Ux2hL.o: In function `.show.t7179':
out.ll:(.text+0xd53): undefined reference to `floatFormatConfig'
/tmp/cc7Ux2hL.o: In function `.show.t7186':
out.ll:(.text+0xd73): undefined reference to `floatFormatConfig'
@jeb2239
jeb2239 / pgo.sh
Created July 23, 2017 04:36 — forked from daniel-j-h/pgo.sh
pgo: profile guided optimization with gcc
# Instrument binaries, pgo data to /data/pgo, serial make is important to not confuse the pgo generator
env CXXFLAGS='-march=native -fprofile-dir=/data/pgo -fprofile-generate=/data/pgo' cmake .. -DCMAKE_BUILD_TYPE=Release
make -j 1
# Run instrumented program, generate and write pgo data
./runIt
# Use profile data and feed into gcc, correct for threading counter noise, serial make is important to not confuse the pgo generator
env CXXFLAGS='-march=native -fprofile-dir=/data/pgo -fprofile-use=/data/pgo -fprofile-correction' cmake .. -DCMAKE_BUILD_TYPE=Release
make -j 1
@jeb2239
jeb2239 / error
Created July 18, 2017 19:15
Rumprun
mkdir -p /home/barriosj/rumprun/./obj-amd64-hw/platform/arch/amd64
mkdir -p /home/barriosj/rumprun/./obj-amd64-hw/platform/arch/x86
( cd /home/barriosj/rumprun/lib/libbmk_core && /home/barriosj/rumprun/./obj-amd64-hw/rumptools/rumpmake MAKEOBJDIR=/home/barriosj/rumprun/./obj-amd64-hw/lib/libbmk_core obj && /home/barriosj/rumprun/./obj-amd64-hw/rumptools/rumpmake MAKEOBJDIR=/home/barriosj/rumprun/./obj-amd64-hw/lib/libbmk_core includes && /home/barriosj/rumprun/./obj-amd64-hw/rumptools/rumpmake BMKHEADERS=/home/barriosj/rumprun/./obj-amd64-hw/include MAKEOBJDIR=/home/barriosj/rumprun/./obj-amd64-hw/lib/libbmk_core dependall )
( cd /home/barriosj/rumprun/lib/libbmk_rumpuser && /home/barriosj/rumprun/./obj-amd64-hw/rumptools/rumpmake MAKEOBJDIR=/home/barriosj/rumprun/./obj-amd64-hw/lib/libbmk_rumpuser obj && /home/barriosj/rumprun/./obj-amd64-hw/rumptools/rumpmake MAKEOBJDIR=/home/barriosj/rumprun/./obj-amd64-hw/lib/libbmk_rumpuser includes && /home/barriosj/rumprun/./obj-amd64-hw/rumptools/rumpmake BMKHEAD
#include <time.h>
#include <sys/time.h>
#ifdef __MACH__
#include <mach/clock.h>
#include <mach/mach.h>
#endif
@jeb2239
jeb2239 / main.cpp
Created February 28, 2017 22:09
Example C++ concepts with gcc 6.2 or greater
//compile this file with gcc 6.2 or greater
#include <iostream>
#include <string>
#include <locale>
#include <vector>
#include <cassert>
#include <list>
using namespace std::literals;
@jeb2239
jeb2239 / Vagrantfile
Last active January 20, 2017 20:46
Vagrantfile for Design Using C++
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@jeb2239
jeb2239 / netcat.py
Created November 14, 2016 21:17 — forked from leonjza/netcat.py
Python Netcat
import socket
class Netcat:
""" Python 'netcat like' module """
def __init__(self, ip, port):
self.buff = ""
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@jeb2239
jeb2239 / gmail.py
Last active September 12, 2016 00:47
import logging
import logging.handlers
class TlsSMTPHandler(logging.handlers.SMTPHandler):
def emit(self, record):
"""
Emit a record.
Format the record and send it to the specified addressees.
"""
import logging
import logging.handlers
smtp_handler = logging.handlers.SMTPHandler(mailhost=("smtp.example.com", 25),
fromaddr="from@example.com",
toaddrs="to@example.com",
subject=u"AppName error!")
logger = logging.getLogger()
@jeb2239
jeb2239 / ThinkLight
Created August 29, 2016 01:03 — forked from vzaliva/ThinkLight
This script controll keyboard backlight on IBM ThinkPad X-series
#!/bin/bash
# Vadim Zaliva lord@crocodile.org
# based on https://gist.github.com/hadess/6847281
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi