Skip to content

Instantly share code, notes, and snippets.

@aybabtme
aybabtme / matrix_mul.js
Created November 20, 2013 17:38
Strassen Matrix Multiplication in Javascript
// Scalar stuff
var Scalar = {};
(function () {
"use strict";
Scalar.mulFunc = function (first, second) {
return first * second;
};
import "net/http/httptrace"
func (cl *httpClient) makeTrace(kvs []*kvpb.KV) *httptrace.ClientTrace {
start := cl.timeNow()
var (
startDial = start
startDNS = start
startConnect = start
startTLS = start
@aybabtme
aybabtme / DequeTest.java
Created August 25, 2012 08:10
Test for a properly working Deque - according to Coursera Algorithms Part 1, asg 2.
import java.util.Iterator;
import java.util.NoSuchElementException;
import junit.framework.TestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
@aybabtme
aybabtme / notes.md
Created February 1, 2022 18:29
wip: workflow orchestration review
@aybabtme
aybabtme / gist:3909791
Created October 18, 2012 03:58
Heroku is messing with me
$ git push heroku master
! Heroku has temporarily disabled this feature, please try again shortly.
! See http://status.heroku.com for current Heroku platform status.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
const magnitudes = [
{magnitude: 1_0000_0000, suffix: "억"},
{magnitude: 1_0000, suffix: "만"},
// {magnitude: 1000, suffix: "천"}, // this works too
];
const krFormat = (num: number): string => {
const m = magnitudes.find((m) => num >= m.magnitude);
if (!m) {
return `${num}`
@aybabtme
aybabtme / update_secret_from_file.sh
Last active November 23, 2020 10:49
Snippet to edit the value of a key in a k8s secret using a file as source for that value.
local namespace=""
local secret=""
local data_key=""
local filename=""
kubectl get secret -n ${namespace} ${secret} -o json \
| jq --arg datakey ${data_key} --argjson value <(base64 -w 0 < ${filename} | jq -R -s '.') '.data[$datakey] = $value' \
| kubectl apply -f -
# Clear the cookies
$ rm cookies.txt
# Create a user
$ curl -v -b cookies.txt -c cookies.txt -X POST 127.0.0.1:8080/api/v0.1/employees -d '{"employeeId":666, "password":"hello"}'
HTTP/1.1 201 Created
# Try querying without auth
$ curl -v -b cookies.txt -c cookies.txt -X GET 127.0.0.1:8080/api/v0.1/employees
HTTP/1.1 401 Unauthorized
Error: Error waiting for Load Balancer (cockroach-lb.stage) to become active: Error issuing read request in LoadbalancerStateRefreshFunc to DigitalOcean for Load Balancer 'e1bf1559-2ded-41bd-88d4-d1e7066bd6e1': GET https://api.digitalocean.com/v2/load_balancers/e1bf1559-2ded-41bd-88d4-d1e7066bd6e1: 504 <!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<title>api.digitalocean.com | 504: Gateway time-out</title>
<meta charset="UTF-8" />
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test "./kubernetes" -v -test.run TestAccKubernetesPod_with_projected_volume -timeout 120m
=== RUN TestAccKubernetesPod_with_projected_volume
TestAccKubernetesPod_with_projected_volume: testing.go:654: Step 0 error: After applying this step, the plan was not empty:
DIFF:
UPDATE: kubernetes_pod.test
spec.0.container.0.command.#: "" => "0"
spec.0.container.0.env.#: "0" => "0"