Skip to content

Instantly share code, notes, and snippets.

@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 / 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
#include <time.h>
#include <sys/time.h>
#ifdef __MACH__
#include <mach/clock.h>
#include <mach/mach.h>
#endif
@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
@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
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'
barriosj@ThinkPad-W530 [03:07:27 PM] [~/go_bazel_project] [master *]
-> % bazel coverage -s //src/...
INFO: Using default value for --instrumentation_filter: "//src".
INFO: Override the above default with --instrumentation_filter
INFO: Analysed 3 targets (21 packages loaded).
INFO: Found 2 targets and 1 test target...
SUBCOMMAND: # //src:go_default_test [action 'Creating runfiles tree bazel-out/k8-fastbuild/bin/src/linux_amd64_stripped/go_default_test.runfiles']
(cd /home/barriosj/.cache/bazel/_bazel_barriosj/b790a967df273339965ace6e27b0005e/execroot/__main__ && \
exec env - \
_bin/build-runfiles bazel-out/k8-fastbuild/bin/src/linux_amd64_stripped/go_default_test.runfiles_manifest bazel-out/k8-fastbuild/bin/src/linux_amd64_stripped/go_default_test.runfiles)
@jeb2239
jeb2239 / IP2Hex.py
Created July 2, 2020 20:04 — forked from LuoZijun/IP2Hex.py
IPv4 Address to a 32-bit integer value
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
IPv4 addresses to a 32-bit integer value
Document: https://en.wikipedia.org/wiki/IPv4#Address_representations
IPv4 addresses may be in any notation expressing a 32-bit integer value,
@jeb2239
jeb2239 / main.cpp
Created September 20, 2020 15:58 — forked from wangyangkobe/main.cpp
Akuna Capital (Shanghai) C++ Coding Challenge For Regular Program
#include <iostream>
#include <fstream>
#include <stdint.h>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#pragma pack(push)
@jeb2239
jeb2239 / EventDispatcher.cpp
Created October 21, 2020 23:51 — forked from sansumbrella/EventDispatcher.cpp
C++ observer pattern for event handling.
#include "EventDispatcher.h"
void EventDispatcher::addListener( Listener *l )
{
mListeners.push_back(l);
}
void EventDispatcher::removeListener( Listener *l )
{
mListeners.erase( std::remove( mListeners.begin(), mListeners.end(), l ), mListeners.end() );