Skip to content

Instantly share code, notes, and snippets.

View reyhansofian's full-sized avatar

Reyhan Sofian reyhansofian

View GitHub Profile
@tallguyjenks
tallguyjenks / logseq-Gruvbox.css
Last active April 24, 2024 14:03
Logseq Gruvbox
@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;700&family=Fira+Sans:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap");
:root {
--background: #282828;
--light-background: #3c3836;
--lighter-background: #504945;
--dark-background: #3c3836;
--darker-background: #1d2021;
--foreground: #ebdbb2;
--current-line: #504954;
@techmexdev
techmexdev / delete-helm-chart-resources.sh
Last active October 15, 2022 20:54
Deletes the leftover resources after purging a chart. Workaround for: https://github.com/helm/helm/issues/6646
#!/usr/bin/env bash
ENV=$1
APP=$2
NAMESPACE=$3
FILENAME=upgrade-error.txt
while true
do
function upgrade() {
@milesbxf
milesbxf / monzo-alertmanager-config.yaml
Last active April 22, 2024 11:24
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active February 13, 2024 14:30
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@flaviocopes
flaviocopes / go-sort-map.go
Last active December 25, 2023 21:03
Go: sort a Map by key #golang
import "sort"
ages := map[string]int{
"a": 1,
"c": 3,
"d": 4,
"b": 2,
}
names := make([]string, 0, len(ages))
@eiriklv
eiriklv / avoiding-exceptions.js
Last active February 2, 2019 12:13
Exception free JavaScript?
/**
* WHY? - BECAUSE EXCEPTIONS/TRY/CATCH IS A GLOBAL HORRIBLE MESS :-(
* Check out error handling in golang: https://blog.golang.org/error-handling-and-go
*/
/**
* Wrap an "unsafe" promise
*/
function safePromise(promise) {
return promise
@vlucas
vlucas / encryption.js
Last active April 2, 2024 14:26
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
@jonico
jonico / Jenkinsfile
Last active January 31, 2024 09:43
Example for a full blown Jenkins pipeline script with CodeQL analysis steps, multiple stages, Kubernetes templates, shared volumes, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, Docker containers, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, …
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, yaml: """
spec:
containers:
- name: mvn
image: maven:3.3.9-jdk-8
@gomar
gomar / 00-intro.md
Last active January 30, 2024 04:58
Setting up a Keynote document for grid layout design

Setting up a Keynote document for grid layout design

I like (love ?) Keynote because it

  • is a simple to use presentation software,
  • is vector based (when zooming it just looks gorgeous)
  • exports to powerpoint

If I could remove that last argument, I would, but the fact is that, as a consultant, the final document is almost always expected to be a powerpoint document. Don't ask me why, it is just so. I am fighting against it but I did not win the battle so far ...

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?