Skip to content

Instantly share code, notes, and snippets.

@chadaustin
chadaustin / .tmux.conf
Last active April 28, 2024 05:36
my tmux config
# Detect the correct TERM value for new sessions.
# if-shell uses /bin/sh, so bashisms like [[ do not work.
if "[ $(tput colors) = 16777216 ]" {
set -g default-terminal "tmux-direct"
} {
if "[ $(tput colors) = 256 ]" {
set -g default-terminal "tmux-256color"
} {
set -g default-terminal "tmux"
}
@rauchg
rauchg / p.sh
Last active April 27, 2024 10:43
Perplexity CLI in pure shell
#!/usr/bin/env bash
function p() {
jq -n \
--arg content "$*" \
'{
"model": "pplx-7b-online",
"messages": [
{
"role": "system",
"content": "Be precise and concise."
@chadaustin
chadaustin / colortest.rs
Created January 2, 2024 04:52
Detect Terminal Color and Character Attribute Support
#!/usr/bin/env -S rust-script -t nightly
#![feature(unix_sigpipe)]
use std::cmp::max;
const BASIC_COLORS: &[&str] = &[
"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white",
];
fn title(t: &str) {
@jiangzhongbo
jiangzhongbo / blaze_face_detect.py
Created April 27, 2020 11:35 — forked from ogl4jo3/blaze_face_detect.py
Demo BlazeFace model.
import cv2
import time
import math
import numpy as np
import tensorflow as tf
class SsdAnchorsCalculatorOptions:
def __init__(self, input_size_width, input_size_height, min_scale, max_scale
, num_layers, feature_map_width, feature_map_height
, strides, aspect_ratios, anchor_offset_x=0.5, anchor_offset_y=0.5
sudo add-apt-repository -y ppa:apt-fast/stable
sudo add-apt-repository -y ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get -y install apt-fast
# prompts
sudo apt-fast -y upgrade
sudo apt-fast install -y python3-pip ubuntu-drivers-common libvorbis-dev libflac-dev libsndfile-dev cmake build-essential libgflags-dev libgoogle-glog-dev libgtest-dev google-mock zlib1g-dev libeigen3-dev libboost-all-dev libasound2-dev libogg-dev libtool libfftw3-dev libbz2-dev liblzma-dev libgoogle-glog0v5 gcc-6 gfortran-6 g++-6 doxygen graphviz libsox-fmt-all parallel exuberant-ctags vim-nox python-powerline python3-pip ack lsyncd
sudo apt-fast install -y tigervnc-standalone-server firefox mesa-common-dev
@dan-zheng
dan-zheng / README.md
Last active March 27, 2019 08:20
Python interoperability in Swift

Python interoperability

Check out this tutorial demonstrating Python interoperability in Swift.

Python library version details

This function is intended to set the Python version before any references to the global PythonInterface called Python - it cannot be used to switch Python versions dynamically.

//
// main.swift
// OptionParser
//
// Created by Chris Eidhof on 28.02.19.
// Copyright © 2019 objc.io. All rights reserved.
//
import Foundation

A quadratic space is a real vector space V with a quadratic form Q(x), e.g. V = R^n with Q as the squared length. The Clifford algebra Cl(V) of a quadratic space is the associative algebra that contains V and satisfies x^2 = Q(x) for all x in V. We're imposing by fiat that the square of a vector should be the quadratic form's value and seeing where it takes us. Treat x^2 = Q(x) as a symbolic rewriting rule that lets you replace x^2 or x x with Q(x) and vice versa whenever x is a vector. Beyond that Cl(V) satisfies the standard axioms of an algebra: it lets you multiply by scalars, it's associative and distributive, but not necessarily commutative.

Remarkably, this is all you need to derive everything about Clifford algebras.

Let me show you how easy it is to bootstrap the theory from nothing.

We know Cl(V) contains a copy of V. Since x^2 = Q(x) for all x, it must also contain a copy of some nonnegative reals.

@mxcl
mxcl / detweet.swift
Last active December 23, 2023 23:22
Delete all tweets and favorites older than two months ago. Instructions in comment.
#!/usr/bin/swift sh
import Foundation
import PromiseKit // @mxcl ~> 6.5
import Swifter // @mattdonnelly == b27a89
let swifter = Swifter(
consumerKey: "FILL",
consumerSecret: "ME",
oauthToken: "IN",
oauthTokenSecret: "https://developer.twitter.com/en/docs/basics/apps/overview.html"
@rxwei
rxwei / ad-manifesto.md
Last active November 9, 2023 09:58
First-Class Automatic Differentiation in Swift: A Manifesto