Skip to content

Instantly share code, notes, and snippets.

View noodlehaus's full-sized avatar

noodlehaus noodlehaus

View GitHub Profile
@noodlehaus
noodlehaus / location-check.py
Created August 23, 2023 16:28
Check if object of interest is within the bounding box.
import cv2
from flask import Flask, Response
from ultralytics import YOLO
app = Flask(__name__)
model2 = YOLO("models/yolov8n-face.pt")
cam = cv2.VideoCapture(0)
if not cam.isOpened():
@noodlehaus
noodlehaus / .vimrc
Created December 18, 2019 07:19
vimrc
" pathogen
execute pathogen#infect()
syntax on
filetype plugin indent on
" colors
set t_Co=256
colorscheme desert256v2
@noodlehaus
noodlehaus / .bashrc
Created March 2, 2015 01:35
bash prompt
# get bash completion for brew
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# git prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \(\1\)/'
}
@noodlehaus
noodlehaus / web_app.php
Last active December 15, 2017 06:39
bare bones routing function for PHP.
<?php
// minimal routing
function web_app($routes, $req_verb, $req_path) {
$req_verb = strtoupper($req_verb);
$req_path = trim(parse_url($req_path, PHP_URL_PATH), '/');
$found = false;
if (isset($routes[$req_verb])) {
<?php
/**
* procedural wrappers for web request/response variables
*
* @author Jesus A. Domingo <jesus.domingo@gmail.com>
* @license MIT
*/
/**
* Gets a request parameter (from $_GET over $_POST combination)
@noodlehaus
noodlehaus / php-recipes.markdown
Last active August 10, 2017 14:41
Some patterns I use in plain old PHP apps

pulling values from arrays

$name = @$_POST['name'];
# => null or the value for name

defaults for associative arrays

@noodlehaus
noodlehaus / detach.js
Created February 14, 2017 03:47
detach methods as functions
function detach(fn, cls) {
if (typeof cls.prototype[fn] !== 'function') {
throw new Error(fn + ' is not an instance function');
}
return cls.prototype[fn].call.bind(cls.prototype[fn]);
}
var slice = detach('slice', Array);
var map = detach('map', Array);
@noodlehaus
noodlehaus / private.xml
Last active October 7, 2016 03:27
Karabiner bindings for pok3r
<?xml version="1.0"?>
<root>
<!-- mac management -->
<item>
<name>Set Command_L + Esc to Window Switch</name>
<identifier>private.cmd_l_esc_to_window_switch</identifier>
<autogen>
__KeyToKey__
KeyCode::ESCAPE,
@noodlehaus
noodlehaus / .vimrc
Last active August 15, 2016 16:12
vim config
" pathogen
execute pathogen#infect()
syntax on
filetype plugin indent on
" colors
set t_Co=256
colorscheme Monokai
@noodlehaus
noodlehaus / .tmux.conf
Last active August 15, 2016 16:12
tmux settings
# behaviour
set -g base-index 1
set -g pane-base-index 1
set -g visual-activity on
set -g default-terminal "screen-256color"
setw -g monitor-activity on
# ctrl-a instead of ctrl-b
# set-option -g prefix C-a