Skip to content

Instantly share code, notes, and snippets.

@wojteklu
wojteklu / clean_code.md
Last active May 2, 2024 19:36
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

@tfausak
tfausak / buoy.hs
Last active May 2, 2024 19:34
keywords: Haskell applicative lift liftA liftA2 liftAN ap hoist raise boost
-- This whole thing is shamelessly stolen from:
-- <https://doisinkidney.com/snippets/nary-uncurry.html>.
-- Without flexible instances, GHC complains about the `HasApply` instances:
--
-- > Illegal instance declaration for `HasApply a Z`. All instance types must
-- > be of the form `(T a1 ... an)` where `a1 ... an` are *distinct type
-- > variables*, and each type variable appears at most once in the instance
-- > head.
--
<!DOCTYPE html>
<html>
<head>
<title>3D Cube with Dynamic Texture</title>
<style>
body {
margin: 0;
overflow: hidden;
background-color: #222;
}
@theffc
theffc / git-proxy.md
Last active May 2, 2024 19:33
Como configurar o git para funcionar com um servidor proxy.

Ativar

Para fazer o git usar um servidor proxy, utilize o seguinte comando:

git config --global http.proxy http://YOUR_PROXY_USERNAME:YOUR_PROXY_PASSWORD@YOUR.PROXY.SERVER:8080

YOUR_PROXY_USERNAME => como é comum o uso de um email para o USERNAME, é necessário utilizar no lugar do @ do email, o seguinte código pwd%40123.

Desativar

@AkdM
AkdM / hideMyEmail.applescript
Last active May 2, 2024 19:33
Generate new "Hide My Email" email with iCloud+ using AppleScript
-- Kill System Preferences first if already open
if application "System Preferences" is running then
tell application "System Events"
set theID to unix id of processes whose name is "System Preferences"
try
do shell script "kill -9 " & theID
delay 0.1
end try
end tell
end if
@cbschuld
cbschuld / parameterStore.ts
Last active May 2, 2024 19:32
Obtain values from the AWS Parameter store with Typescript/node
import { SSM } from "aws-sdk";
const getParameterWorker = async (name:string, decrypt:boolean) : Promise<string> => {
const ssm = new SSM();
const result = await ssm
.getParameter({ Name: name, WithDecryption: decrypt })
.promise();
return result.Parameter.Value;
}
@the-spyke
the-spyke / pipewire.md
Last active May 2, 2024 19:30
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.

<!DOCTYPE html>
<html>
<head>
<title>3D Cube with Dynamic Texture</title>
<style>
body {
margin: 0;
overflow: hidden;
background-color: #222;
}
<!DOCTYPE html>
<html>
<head>
<title>3D Cube with Dynamic Texture</title>
<style>
body {
margin: 0;
overflow: hidden;
background-color: #222;
}