Skip to content

Instantly share code, notes, and snippets.

Hi Mayor Carter,
Like many citizens of Saint Paul, I've been glued to the news this week. As protests spread from Minneapolis to Saint Paul, I've been shocked at how cops are ESCALATING this situation instead of DE-ESCALATING it.
We need police reform, and training is not enough.
I want to show you what a cop told me.
"The training involved lecture, personal testimony from people who have had crisis interactions with police, and role-playing scenarios, in which the cops are tested. They generally did not do well. Many didn’t take the training seriously. Most don’t respond well to being challenged. They want to be obeyed. They want total control. People in crisis rarely give them that, and things tend to escalate. The cops are taught how to deescalate situations, using techniques such as mirroring, silence, and modulating the tempo. But, as I said, many of them consider this stuff bullshit. A culture change is necessary, from the top down and from the ground up. A big help would be if cops were legally held
Hi Governor Walz and Lt Governor Flanagan,
Like many citizens of the Twin Cities, I've been glued to the news this week. I want to let you know I'm so thankful that Chauvin got arrested.
Now he needs to be convicted and go to jail.
I've seen again and again that the police get let off with a slap on the wrist. This does not work.
I want to show you what a cop told me.
"The training involved lecture, personal testimony from people who have had crisis interactions with police, and role-playing scenarios, in which the cops are tested. They generally did not do well. Many didn’t take the training seriously. Most don’t respond well to being challenged. They want to be obeyed. They want total control. People in crisis rarely give them that, and things tend to escalate. The cops are taught how to deescalate situations, using techniques such as mirroring, silence, and modulating the tempo. But, as I said, many of them consider this stuff bullshit. A culture change is necessary, from the top down and from the grou
@egonSchiele
egonSchiele / phan_conditional.diff
Created March 11, 2016 02:15
Add a closure for conditionals to phan
diff --git a/src/Phan/Analysis/PreOrderAnalysisVisitor.php b/src/Phan/Analysis/PreOrderAnalysisVisitor.php
index 8650cd3..feaaee4 100644
--- a/src/Phan/Analysis/PreOrderAnalysisVisitor.php
+++ b/src/Phan/Analysis/PreOrderAnalysisVisitor.php
@@ -508,11 +508,16 @@ class PreOrderAnalysisVisitor extends ScopeVisitor
*/
public function visitIfElem(Node $node) : Context
{
+ $closure_fqsen =
+ FullyQualifiedFunctionName::fromClosureInContext(
@egonSchiele
egonSchiele / non_linear_classification.m
Created March 10, 2016 04:10
Non-linear classification example
% my training data.
% so if x > 3 || x < 7, y = 1, otherwise y = 0.
x = 1:100;
y = [0, 0, 0, 1, 1, 1, 1, zeros(1, 93)];
% instead of theta' * x, I'm trying to create
% a non-linear decision boundary.
% So instead of y = theta_0 + theta_1 * x, I use:
function result = h(x, theta)
result = sigmoid(theta(1) + theta(2) * x + theta(3) * ((x - theta(4))^2));
@egonSchiele
egonSchiele / logistic_regression_grapefruit.m
Created March 10, 2016 03:54
Logistic regression for orange vs grapefruit
% data
x = [1, 2, 3, 4, 5, 6];
y = [0, 0, 0, 1, 1, 1];
% function to calculate the predicted value
function result = h(x, t0, t1)
result = sigmoid(t0 + t1 * x);
end
% sigmoid function
@egonSchiele
egonSchiele / linear_regression_with_fminunc.m
Created March 9, 2016 23:48
Linear regression with fminunc
x = [1000, 2000, 4000];
y = [200000, 250000, 300000];
% given a theta_0 and theta_1, this function calculates
% their cost. We don't need this function, strictly speaking...
% but it is nice to print out the costs as gradient descent iterates.
% We should see the cost go down every time the values of theta get updated.
function distance = cost(theta)
theta_0 = theta(1);
theta_1 = theta(2);
% my training data.
% so if x > 3 || x < 7, y = 1, otherwise y = 0.
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
y = [0, 0, 0, 1, 1, 1, 0, 0, 0, 0];
% instead of theta' * x, I'm trying to create
% a non-linear decision boundary.
function result = h(x, theta)
result = sigmoid(theta(1) + theta(2) * x + theta(3) * ((x - theta(4))^2));
end
@egonSchiele
egonSchiele / regression.m
Last active March 28, 2021 12:46
Linear regression in Octave
% scaled features.
% x = square feet
% y = sale price
x = [1, 2, 4];
y = [2, 2.5, 3];
% function to calculate the predicted value
function result = h(x, t0, t1)
result = t0 + t1 * x;
end
@egonSchiele
egonSchiele / Main.hs
Last active November 12, 2015 23:25
kcombinations
{-# LANGUAGE MultiWayIf #-}
import Data.List
import Control.Monad
import Control.Monad.Trans.Writer
kcombinations n arr = snd . runWriter $ combos [] 1 n arr
combos :: (Eq a) => [a] -> Int -> Int -> [a] -> Writer [[a]] ()
combos acc step n array = forM_ (zip array [1..]) $ \(val, i) -> if
| val `elem` acc -> return ()

Keybase proof

I hereby claim:

  • I am egonschiele on github.
  • I am adit (https://keybase.io/adit) on keybase.
  • I have a public key whose fingerprint is 31AE C08A 8B28 F75B 596D 8146 0264 FC99 3D75 484F

To claim this, I am signing this object: