One machine, several git identities: typically personal vs work, GitHub vs GitLab, or two accounts on the same provider. This setup makes every repository pick the right name, email, and keys on its own, so no work commit ever goes out under your personal address (or the reverse). In a hurry: run the Appendix B script once per identity.
| const express = require('express') | |
| const app = express() | |
| app.get('/ping', (req, res) => { | |
| const now = Date.now(), | |
| day = 8.64e7 | |
| // calculate midnight today and tomorrow | |
| const midnight = Math.floor(now / day) * day | |
| const midnightDate = new Date(midnight) |
| #!/bin/sh | |
| # Install Alpine Linux on ZFS, on LUKS, with FDE and standalone UEFI GRUB | |
| set -e | |
| cat << EOF > answers.txt | |
| KEYMAPOPTS="us us" | |
| HOSTNAMEOPTS="-n localhost" | |
| INTERFACESOPTS="auto lo |
| #!/usr/bin/env kotlin | |
| /** | |
| * A Kotlin script that will collect all test reports and core dumps from your CI runs | |
| * zip them and upload them as a Github Actions artifact | |
| * | |
| * Copy this file to scripts/collect-diagnostics.main.kts and add the below to your | |
| * Github Actions workflow file: | |
| * | |
| * - name: Collect Diagnostics |
| extension Color { | |
| /// Return a random color | |
| static var random: Color { | |
| return Color( | |
| red: .random(in: 0...1), | |
| green: .random(in: 0...1), | |
| blue: .random(in: 0...1) | |
| ) | |
| } | |
| } |
| // | |
| // ContentView.swift | |
| // Shared | |
| // | |
| // Created by Costantino Pistagna on 25/03/21. | |
| // | |
| import SwiftUI | |
| struct ContentView: View { |
The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).
My take-aways are:
-
You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.
-
Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse
In this example I am spinning up 2 web servers and 2 file servers using Terraform. During the provision process, Terraform will run a remote-exec script to bind the 4 new servers to the salt master server.
Substitute actual user and API key for SL_USERNAME and SL_API_KEY
export TF_VAR_slusername="SL_USERNAME"
export TF_VAR_slapikey="SL_API_KEY"
| # ---------------------------------------------------------------------------------- | |
| # r u s t f m t - C O N F I G | |
| # ================================================================================== | |
| # | |
| # Version: 0.7.1 | |
| # Author : Robbepop <robbepop@web.de> | |
| # | |
| # A predefined .rustfmt.toml file with all configuration options and their | |
| # associated description, possible values and default values for use in other | |
| # projects. |