Skip to content

Instantly share code, notes, and snippets.

View akrabat's full-sized avatar

Rob Allen akrabat

View GitHub Profile
@ciaranmcnulty
ciaranmcnulty / notes.md
Last active March 25, 2024 06:36
Notes on using Docker on ARM Macs (November 2021)

Docker for Mac

On M1 machines, Docker for Mac is running a lightweight linux ARM VM, then running containers within that, so containers are essentially running natively. Don't be fooled by the fact the UI or binary CLI tools (e.g. docker) might require Rosetta.

Within that VM is an emulation layer called QEmu. This can be used by docker to run Intel containers. This does not use Rosetta at all, and has a roughly 5-6X performance penalty. (If you just upgraded your CPU this may result in a similar performance to your old machine!)

Pulling and running with Docker

Many images in public registries are multi-architecture. For instance at the time of writing on Docker Hub the php:8.0-cli image has the following digests:

@PurpleBooth
PurpleBooth / README.md
Last active September 17, 2021 15:07
Change your default branch on github without checkout anything out

change-github-default-branch.sh

Usage

change-github-default-branch.sh "$GITHUB_TOKEN" PurpleBooth/homebrew-repo

Does not delete the old default branch, or change where pull requests are based from, incase something breaks.

<?php
class Repository
{
public function findAll(): array
{
return $this->connection->project(
sprintf('SELECT * FROM %s', self::TABLE_NAME),
[],
function(array $row): Domain\MyObject {
return Domain\MyObject::fromArray($row);
@csantanapr
csantanapr / deploy_serverless_bx_wsk.sh
Last active May 30, 2018 21:44
Using serverless framework and ibm cloud functions CLI bx wsk
#!/bin/bash
set -e
#Choose command to use to deploy repo (script, wskdeploy, serverless, etc.)
#WSK_DEPLOY="wskdeploy"
WSK_DEPLOY="serverless deploy"
# To create BX_KEY value run: bx iam api-key-create MyKey (save the secret value as it can't be retrieved)
BX_KEY=AAAABBBB123456
@jeremykendall
jeremykendall / docker-compose.yml
Created December 16, 2016 02:18
My jankie, but functional, PHP/MySQL/nginx docker env
version: '2'
services:
nginx:
build:
context: ./
dockerfile: ./resources/nginx/nginx.dockerfile
volumes:
- ./:/var/www/html
- ./resources/nginx/default.conf:/etc/nginx/conf.d/default.conf
@lornajane
lornajane / mac.md
Last active April 21, 2024 15:04
Keyboard Only OS X

Keyboard-only Mac Cheatsheet

Hi, I'm Lorna and I don't use a mouse. I have had RSI issues since a bad workstation setup at work in 2006. I've tried a number of extra hardware modifications but what works best for me is to use the keyboard and only the keyboard, so I'm in a good position and never reaching for anything else (except my coffee cup!). I rather unwisely took a job which required me to use a mac (I've been a linux user until now and also had the ability to choose my tools carefully) so here is my cheatsheet of the apps, tricks and keyboard shortcuts I'm using, mostly for my own reference. Since keyboard-only use is also great for productivity, you may also find some of these ideas useful, in which case at least something good has come of this :)

Apps List

There's more detail on a few of these apps but here is a quick overview of the tools I've installed and found helpful

Tool Link Comments
#if os(Linux)
import Glibc
#else
import Darwin
#endif
// Still not lovely but tested under OS X Swift 3 and Linux Swift 3
// Use fopen/fwrite to output string
func writeStringToFile(string: String, path: String) -> Bool {
@boneskull
boneskull / README.md
Last active June 24, 2023 13:42
syntax highlighting for Vagrantfile in non-RubyMine JetBrains IDEs
  1. Add this file to /path/to/prefs/filetypes/
  2. Restart IDE

This page will help you find the correct directory.

#!/bin/bash
#
# Faster toolchain build: skips as much as possible.
#
# To use this toolchain from the command line:"
# export TOOLCHAINS=$(whoami)
#
# we build to the same prefix every time (instead of building
# to a versioned prefix) because every time the prefix changes
# *everything* rebuilds.
@bezhermoso
bezhermoso / notification-actions.applescript
Last active February 11, 2023 09:54
Handly AppleScripts to manage OS X notifications. (Use in Automator, bind to keyboard shortcuts via BetterTouchTool, etc.) Inspired by http://apple.stackexchange.com/a/155736
# Close all notifications
my closeNotifications()
on closeNotifications()
tell application "System Events" to tell process "Notification Center"
set theWindows to every window
repeat with i from 1 to number of items in theWindows
set this_item to item i of theWindows
try
click button 1 of this_item