Skip to content

Instantly share code, notes, and snippets.

View oxbambooxo's full-sized avatar

Ben oxbambooxo

View GitHub Profile
@vigevenoj
vigevenoj / Instructions for building manually without packaging
Last active April 23, 2021 14:25
Building mosquitto on centos 6 with websocket support
sudo yum install wget mercurial cmake openssl-devel c-ares-devel libuuid-devel
wget https://github.com/warmcat/libwebsockets/archive/v2.1.0.tar.gz
tar xf v2.1.0.tar.gz
cd libwebsockets-2.1.0
mkdir build; cd build
cmake .. -DLIB_SUFFIX=64
sudo make install
echo "/usr/local/lib64" | sudo tee -a /etc/ld.so.conf.d/libwebsockets.conf
sudo ldconfig
ldconfig -p | grep libwebsockets
@carcinocron
carcinocron / debugger pause beforeunload
Last active April 14, 2025 17:13
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
@hmartiro
hmartiro / zeromq-vs-redis.md
Last active December 16, 2024 04:02
Comparison of ZeroMQ and Redis for a robot control platform

ZeroMQ vs Redis

This document is research for the selection of a communication platform for robot-net.

Goal

The purpose of this component is to enable rapid, reliable, and elegant communication between the various nodes of the network, including controllers, sensors, and actuators (robot drivers). It will act as the core of robot-net to create a standardized infrastructure for robot control.

Requirements:

git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@sibnerian
sibnerian / sed_replace.sh
Created July 18, 2014 16:54
Using sed to replace text in file on Mac OSX
sed_replace() {
# require all 3 parameters
if [ .$1 = . ] || [ .$2 = . ] || [ .$3 = . ]; then
echo "Usage: sed_replace [oldString] [newString] [targetFile]"
return 0
fi
local oldString=$1
local newString=$2
local targetFile=$3
local temp=`mktemp -t sed_replace.XXXXXXXXX`
@iwill
iwill / git-cb.sh
Last active October 30, 2023 09:19
git checkout with grep patterns
#!/bin/bash
# alias in gitconfig:
# cb = "!sh ~/.git-cb.sh"
# usage:
# git cb ev lo # *ev*lo* - `develop` will be matched
# cb = "!checkoutbranch() { local branches=`git branch | grep -i $1 | tr -d '* '`; if [[ `echo \"$branches\" | wc -l | tr -d ' '` != 1 ]]; then echo \"Matched multiple branches:\"; git branch | grep --color -i $1; exit 1; fi; git checkout $branches; }; checkoutbranch"
branches=`git branch`
@staltz
staltz / introrx.md
Last active April 19, 2025 05:15
The introduction to Reactive Programming you've been missing
@oro350
oro350 / rawfilter.c
Created January 5, 2014 15:46
SO_ATTACH_FILTER usage
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/ethernet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <netpacket/packet.h>
#!/bin/sh
#
# /etc/rc.d/init.d/supervisord
#
# Supervisor is a client/server system that
# allows its users to monitor and control a
# number of processes on UNIX-like operating
# systems.
#
# chkconfig: - 64 36
def verify_sign(public_key_loc, signature, data):
'''
Verifies with a public key from whom the data came that it was indeed
signed by their private key
param: public_key_loc Path to public key
param: signature String signature to be verified
return: Boolean. True if the signature is valid; False otherwise.
'''
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5