Skip to content

Instantly share code, notes, and snippets.

View sdesalas's full-sized avatar
🕹️

Steven de Salas sdesalas

🕹️
View GitHub Profile
@sdesalas
sdesalas / scar_tissue.md
Created May 28, 2023 16:30 — forked from gtallen1187/scar_tissue.md
talk given by John Ousterhout about sustaining relationships

"Scar Tissues Make Relationships Wear Out"

04/26/2103. From a lecture by Professor John Ousterhout at Stanford, class CS142.

This is my most touchy-feely thought for the weekend. Here’s the basic idea: It’s really hard to build relationships that last for a long time. If you haven’t discovered this, you will discover this sooner or later. And it's hard both for personal relationships and for business relationships. And to me, it's pretty amazing that two people can stay married for 25 years without killing each other.

[Laughter]

> But honestly, most professional relationships don't last anywhere near that long. The best bands always seem to break up after 2 or 3 years. And business partnerships fall apart, and there's all these problems in these relationships that just don't last. So, why is that? Well, in my view, it’s relationships don't fail because there some single catastrophic event to destroy them, although often there is a single catastrophic event around the the end of the relation

@sdesalas
sdesalas / TwitterClient.cs
Last active May 26, 2023 03:34
An ultra-lightweight Twitter client in C# using OAuth
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Security.Cryptography;
using System.Linq;
using System.Text.RegularExpressions;
using System.Net;
using System.Web;
@sdesalas
sdesalas / check.sh
Created April 8, 2023 21:49
Self CICD using Cron + Git
#!/bin/bash
#
# Helps redeploy services when there are git remote changes
#
# @usage: sudo ./check.sh [branch] [--force]
# @example: sudo ./check.sh origin/master --force
PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
FETCH=$(git fetch)
UPSTREAM=${1:-'origin/master'}
@sdesalas
sdesalas / oneline.ratelimit.test.sh
Last active April 8, 2023 13:13
Bash oneline http rate limit test
!# /bin/bash
time for i in `seq 1 50`; do curl -s -o /dev/null -H "Authorization: $AUTH" -w "$i %{http_code}\n" http://localhost:8080/api/endpoint; done;
@sdesalas
sdesalas / simple.launch.json
Created March 27, 2023 09:55
VS Code debugging
{
"version": "0.2.0",
"configurations": [
{
"name": "Inspect",
"request": "launch",
"type": "node-terminal",
"command": "node --inspect index.js"
}
]
var AWS = require('aws-sdk');
console.log(process.env);
var sts = new AWS.STS();
sts.getCallerIdentity({},
(err, data) => err && console.log("Error", err) || console.log(JSON.stringify(data.Account)));
@sdesalas
sdesalas / hero-on-docker.bulleye-slim.log
Last active March 11, 2023 12:50
Compiling reasoning hero/zero
$ docker run -it --rm debian:bullseye-slim /bin/bash
root@789bc626502d:/# apt update && apt install -y git build-essential cmake
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:5 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [234 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [14.6 kB]
Fetched 8640 kB in 4s (2393 kB/s)
Reading package lists... Done
@sdesalas
sdesalas / fancy.git.commands.sh
Last active March 10, 2023 15:31
Git like a pro
# Remove commit from current branch. Remote branch is MINE: I dont care about other people's commits (bad).
git rebase --onto $COMMIT_HASH^ $COMMIT_HASH && git push --force
# Remove commit from current branch. Remote branch is SHARED: Be careful with other people's commits.
git rebase --onto $COMMIT_HASH^ $COMMIT_HASH && git push --force-with-lease
# Alternate to rebasing
git reset --soft $COMMIT_HASH_BEFORE_CHANGES or HEAD~$NO_COMMITS_BEHIND
git stash
git checkout uat
const util = require('util');
setTimeout(async () => {
db.getData = util.promisify(db.getData);
db.processData = util.promisify(db.processData);
db.saveData = util.promisify(db.saveData);
try {
@sdesalas
sdesalas / various.sh
Created May 22, 2022 17:35
Db backup scripts
for DB in $(mysql -u root -p<password> -h <IP of DB> -e 'show databases' -s --skip-column-names); do
mysqldump -u root -p<password> -h<IP of DB> $DB > "$DB.sql";