Skip to content

Instantly share code, notes, and snippets.

View carlgieringer's full-sized avatar
:shipit:

Carl Gieringer carlgieringer

:shipit:
View GitHub Profile
@carlgieringer
carlgieringer / matchActions.ts
Created December 11, 2022 06:07
A helper for matching multiple redux action creators producing a typed action.
import { AnyAction, ActionCreatorWithPreparedPayload } from "@reduxjs/toolkit";
/**
* A helper for matching multiple redux action creators producing a typed action.
*
* Usage:
*
* ```
* export default createReducer(initialState, builder => {
* builder.addMatcher(
@carlgieringer
carlgieringer / Python0to60in280Chars.sh
Last active July 25, 2021 13:43
Python0to60in280Chars
#Python0to60in280Chars
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install pyenv pyenv-virtualenv
echo 'eval "$(pyenv init --path)"; eval "$(pyenv virtualenv-init -)"' >> ~/.profile
source !$
pyenv install 3.9.6
pyenv virtualenv 3.9.6 my_proj
pyenv local my_proj
python
@carlgieringer
carlgieringer / sesTest.js
Last active August 6, 2020 03:02
AWS SES via VPC Lambda
'use strict';
const aws = require('aws-sdk');
exports.handler = async (event, context, callback) => {
const region = process.env.aws_region;
const endpoint = process.env.ses_endpoint;
const do_use_sesv2 = process.env.sesv2;
console.log({region, endpoint, do_use_sesv2});
const sslEnabled = true;
@carlgieringer
carlgieringer / make.out
Created July 15, 2020 05:41
Output from faiss make
g++ -std=c++11 -DFINTEGER=int -I. -fPIC -m64 -Wno-sign-compare -g -O3 -Wall -Wextra -mpopcnt -msse4 -c AutoTune.cpp -o AutoTune.o
In file included from AutoTune.cpp:31:
In file included from ./faiss/MetaIndexes.h:16:
In file included from ./faiss/IndexShards.h:12:
In file included from ./faiss/impl/ThreadedIndex.h:80:
./faiss/impl/ThreadedIndex-inl.h:164:48: warning: unused parameter 'index' [-Wunused-parameter]
ThreadedIndex<IndexT>::onAfterAddIndex(IndexT* index) {
^
./faiss/impl/ThreadedIndex-inl.h:169:51: warning: unused parameter 'index' [-Wunused-parameter]
ThreadedIndex<IndexT>::onAfterRemoveIndex(IndexT* index) {
@carlgieringer
carlgieringer / gist:63e28ad56fe9653b82201cef1e5d77c2
Created June 15, 2018 23:02
YADR ZSH dot parent expansion
# Uncomment this line from YADR to enable zsh to expand ... to ../..
# https://github.com/skwp/dotfiles
# zstyle ':prezto:module:editor' dot-expansion 'yes'
sed -e '/dot-expansion/ s/^#[# ]*//' -i ~/.yadr/zsh/prezto-override/zpreztorc
@carlgieringer
carlgieringer / integration-request.vtl
Last active June 14, 2022 05:30
AWS API Gateway Integration Request Lambda Proxy (LAMBDA_PROXY) Velocity Template Language (VTL)
## MIT License
##
## Copyright (c) 2017 Carl Gieringer
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
@carlgieringer
carlgieringer / Simplex.py
Created March 7, 2017 17:37 — forked from cathcart/Simplex.py
Simplex algorithm in Python (c) 2001 Vivake Gupta, retrieved from archive.org
#!/usr/bin/env python
#
# Copyright (c) 2001 Vivake Gupta (vivakeATomniscia.org). All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,