Skip to content

Instantly share code, notes, and snippets.

@craigtp
craigtp / AdvancedDistributedSystemDesignCourseNotes.md
Created May 1, 2020 19:38
Notes on Udi Dahan's Advanced Distributed System Design Course

Advanced Distributed System Design Course - Udi Dahan

Notes by Craig Phillips

Fallacies of Distributed Computing

  • There are 11 fallacies of Distributed Computing:
    1. The network is reliable
    2. Latency isn’t a problem
    3. Bandwidth isn’t a problem
    4. The network is secure
  1. The topology won’t change
@ww9
ww9 / context_keys_as_struct_not_int_or_string.md
Last active May 8, 2024 04:27
Why use empty struct{} and not int or string for context.Value() key types in #go

Use struct{} as keys for context.Value() in Go

In the other file of this gist I detail why we should use struct{} as context.Value() keys and not int or string. Open gist to see main.go but the TLDR is:

	type key struct{}
	ctx = context.WithValue(ctx, key{}, "my value") // Set value
	myValue, ok := ctx.Value(key{}).(string) // Get value
internal class ConfigurableLoggerFiltering : IFilterLoggerSettings
{
private CancellationTokenSource cts;
private IChangeToken token;
private List<(string category, LogLevel level)> levels = new List<(string category, LogLevel level)>();
public ConfigurableLoggerFiltering()
{
this.Reload();
}
@OndraZizka
OndraZizka / switchHeadphones.sh
Last active May 29, 2024 13:43
Bluetooth headset - switch between quality sound + no mic (A2DP) and crappy sound and mic (HSP/HFP)
#!/bin/bash
#### Restart Bluetooth
if [ "$1" == "resetBT" ] ; then
sudo rfkill block bluetooth && sleep 0.1 && sudo rfkill unblock bluetooth;
exit;
fi;
#### Toggle listen/speak
if [ "$1" == "" -o "$1" == "toggle" ] ; then
@itaysk
itaysk / get-latest-version-dockerhub.sh
Last active May 23, 2024 16:14
Get latest (highest) version of a Docker Hub image
curl -L --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=1000" | \
jq '.results | .[] | .name' -r | \
sed 's/latest//' | \
sort --version-sort | \
tail -n 1
@gazlu
gazlu / backup-localdb-database.bat
Created December 6, 2016 18:44
Backup SQL Server localdb database with sqlcmd
sqlcmd -E -S "(localdb)\v11.0" -q "BACKUP DATABASE <DBNAME> TO DISK='<DRIVE>:\<FOLDER_PATH>\<BACKUP_FILE_NAME>.bak'"
@paladini
paladini / aws-ec2-redis-cli.md
Last active February 20, 2024 04:05 — forked from todgru/aws-ec2-redis-cli.md
AWS redis-cli without redis server on AWS EC2

Setup redis-cli without the whole Redis Server on AWS EC2

This fast tutorial will teach you how to install redis-clion AWS EC2 without having to install the whole Redis Server. Firstly, SSH into your EC2 instance and run the following command:

$ sudo yum install gcc

This may return an "already installed" message, but that's OK. After that, just run:

$ wget http://download.redis.io/redis-stable.tar.gz && tar xvzf redis-stable.tar.gz && cd redis-stable && make && sudo cp src/redis-cli /usr/local/bin/ && sudo chmod 755 /usr/local/bin/redis-cli

@wojteklu
wojteklu / clean_code.md
Last active June 2, 2024 16:09
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@jcouture100
jcouture100 / MsSqlRecipe.cs
Last active September 13, 2023 12:30
ScintillaNET MSSQL Recipe
// Reset the styles
scintilla.StyleResetDefault();
scintilla.Styles[Style.Default].Font = "Courier New";
scintilla.Styles[Style.Default].Size = 10;
scintilla.StyleClearAll();
// Set the SQL Lexer
scintilla.Lexer = Lexer.Sql;
// Show line numbers

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.