Skip to content

Instantly share code, notes, and snippets.

View aprehot's full-sized avatar
:octocat:
feeling gucci

Aid7 aprehot

:octocat:
feeling gucci
View GitHub Profile
@bocon13
bocon13 / mininetSocketTest.py
Last active March 22, 2022 20:20
Example of opening a UDP socket in a Mininet host and writing the received packets to a file
#!/usr/bin/python
from mininet.topo import Topo, SingleSwitchTopo
from mininet.net import Mininet
from mininet.log import lg, info
from mininet.cli import CLI
def main():
lg.setLogLevel('info')
@bidulock
bidulock / tc-slow.sh
Last active January 8, 2024 16:41
Slow down traffic on localhost through a single port
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "You must run this as root."
exit 1
fi
I=lo
PORT=${PORT-23000}
DELAY=${DELAY-25ms}
import Reconciler from 'react-reconciler'
import omit from 'lodash/omit'
import capitalize from 'lodash/capitalize'
import { actions as elementActions } from './store/elements'
import * as Elements from './elements'
const roots = new Map()
const emptyObject = {}
const Renderer = Reconciler({
@adamschachne
adamschachne / socketMiddleware.js
Created August 18, 2018 23:01
Redux WebSocket middleware
import { Socket } from './Socket';
export const createSocketMiddleware = (host, port) => store => {
const socket = new Socket(host, port);
socket.onopen = () => {
store.dispatch({ type: "SOCKET_OPEN" });
}
socket.onclose = () => {
@aweary
aweary / App.js
Last active August 29, 2021 14:06
import React from "react";
import useMutableReducer from "./useMutableReducer";
const reducer = (draft, action, state) => {
switch (action) {
case "increment":
draft.count++;
break;
case "decrement":
draft.count--;