Skip to content

Instantly share code, notes, and snippets.

View mgalgs's full-sized avatar
🍔
pizza

Mitchel Humpherys mgalgs

🍔
pizza
View GitHub Profile
@mgalgs
mgalgs / scapy_bridge.py
Created February 18, 2012 00:58
python ethernet bridge
#!/usr/bin/python2
import sys
import signal
from threading import Thread,Lock
from scapy.all import sniff,IP,sendp,srp1,Ether,ARP,get_if_list,get_if_hwaddr
def usage():
print 'Usage: scapy_throuput.py host1_interface host1_ip host2_interfcae host2_ip'
@mgalgs
mgalgs / rolemongering_verbosity.txt
Created September 26, 2023 23:43
Custom instructions for ChatGPT that add "verbosity" and "role" user settings
You'll adopt roles and verbosity according to user settings:
R=<role> V=<level>
Roles:
- E = Engineering virtuoso (e.g., electrical, computer, software, etc.)
- B = Business/finance virtuoso (e.g., economics, investments, geopolitics, etc.)
- G = Highly intelligent generalist with a wide variety of knowledge.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>GPS Coordinates Area</name>
<Placemark>
<name>Rectangle Area</name>
<Style>
<LineStyle>
<color>ff0000ff</color>
<width>2</width>
%% https://en.wikibooks.org/wiki/LaTeX/Letters
\documentclass[12pt]{letter}
\usepackage[a4paper,left=2cm, right=2cm, top=1.5cm, bottom=1.5cm]{geometry}
\signature{Your Name}
\address{Your Name
\\ Address1
\\ City, STATE 00000
\\ (555) 867-5309
\\ you@example.com}
\begin{document}
@mgalgs
mgalgs / active_window_xlib_demo.py
Created December 7, 2019 00:13
python-xlib example that prints the bbox of the currently active window
# Print the name and bounding box (x1, y1, x2, y2) for the active window in
# a loop.
import time
from collections import namedtuple
import Xlib
import Xlib.display
@mgalgs
mgalgs / .gitignore
Last active April 16, 2021 06:15
ftd_stats.py
/cnsfails202101b.txt
/cnsfails202102a.txt
/cnsfails202102b.txt
/cnsfails202103b.txt
/cnsfails202103a.txt
import sys
import os
import tensorflow as tf
def usage():
proggie = os.path.basename(sys.argv[0])
print(f"""\
Usage: {proggie} <input_saved_model_dir> <output>
// imgLib -> Image package from https://pub.dartlang.org/packages/image
import 'package:image/image.dart' as imglib;
import 'package:camera/camera.dart';
imglib.Image convertCameraImagetoImage(CameraImage image) {
try {
if (image.format.group == ImageFormatGroup.yuv420) {
return _convertYUV420(image);
} else if (image.format.group == ImageFormatGroup.bgra8888) {
return _convertBGRA8888(image);
#define __define_initcall(level,fn,id) \
static initcall_t __initcall_##fn##id __used \
__attribute__((__section__(".initcall" level ".init"))) = fn
#define core_initcall(fn) __define_initcall("1",fn,1)
#define subsys_initcall(fn) __define_initcall("4",fn,4)
#define late_initcall(fn) __define_initcall("7",fn,7)
/* trimmed, obviously... */
@mgalgs
mgalgs / bndbox.dart
Created July 31, 2020 19:33
tflite detection error repro
// Based on https://github.com/shaqian/flutter_realtime_detection
import 'package:flutter/material.dart' show Border, BoxDecoration, BuildContext, Color, Container, EdgeInsets, FontWeight, Positioned, Stack, StatelessWidget, Text, TextStyle, Widget;
import 'dart:math' as math;
class BndBox extends StatelessWidget {
final List<dynamic> results;
final int previewH;
final int previewW;
final double screenH;