Skip to content

Instantly share code, notes, and snippets.

View CharlesIC's full-sized avatar
💻
Coding...

Charles Karol Gancarz CharlesIC

💻
Coding...
  • Government Digital Service
  • London, UK
View GitHub Profile
@nelstrom
nelstrom / access-control-lists-on-osx.md
Last active December 9, 2023 23:29
Setting ACL on OS X

I have two user accounts set up on my mac. User drew I use for most things, but if I'm making a screencast I'll switch to the demo user. I know that the demo user has a clean desktop, and the font size is larger than usual in my terminal and text editors, making everything a bit more legible when capturing the screen. When I record a screencast as the demo user, I save the file to /Users/Shared/screencasts. As I understand it, the /Users/Shared directory is supposed to be accessible to all user accounts on the mac. If I created and saved a screenflow document as the demo user, I should be able to read and write that file when logged in as user drew.

That was the theory, but it didn't always work out that well in practice. I would occasionally find that a directory was only writable by one user or the other. Perhaps I'd open a screenflow document as user drew and attempt to export the video to the same directory, only to find that the directory was owned by demo, meaning that I couldn't cr

@chrisdarroch
chrisdarroch / idea
Created October 17, 2013 03:40
Open a project in IntelliJ IDEA from your command line!
#!/bin/sh
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1`
wd=`pwd`
# were we given a directory?
if [ -d "$1" ]; then
# echo "checking for things in the working dir given"
wd=`ls -1d "$1" | head -n1`
@luca-barbieri
luca-barbieri / Facebook.cs
Last active February 16, 2018 11:26
Facebook Login button for Xamarin Forms
// This code has been placed in the public domain.
// NO WARRANTY OF ANY KIND
// WORK IN PROGRESS AND ONLY LIMITED TESTING, MIGHT BE PARTIALLY BROKEN
// Note that you need to setup both your iOS and Android projects to include your app id and so on for this to actually work (see the Facebook docs for each platform)
// Common
public class FacebookLoginEventArgs : EventArgs
{
@rcanepa
rcanepa / gist:8a334d7c4f46df948c676aab489fe2c2
Last active January 5, 2024 07:33
Undo committed files (move them back to the staging area without cancelling changes)
- Reset current branch to the parent of HEAD
git reset --soft HEAD~
- Reset the unwanted files in order to leave them out from the commit:
git reset HEAD path/to/unwanted_file
- Commit again using the same commit message:
git commit -c ORIG_HEAD
(*) git reset --soft HEAD~
@kevin-smets
kevin-smets / 1_kubernetes_on_macOS.md
Last active May 5, 2024 10:12
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@mdonkers
mdonkers / server.py
Last active May 27, 2024 08:05
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@briansmith
briansmith / how-to-generate-and-use-private-keys-with-openssl-tool.md
Last active April 11, 2024 17:02
How to generate & use private keys using the OpenSSL command line tool

How to Generate & Use Private Keys using OpenSSL's Command Line Tool

These commands generate and use private keys in unencrypted binary (not Base64 “PEM”) PKCS#8 format. The PKCS#8 format is used here because it is the most interoperable format when dealing with software that isn't based on OpenSSL.

OpenSSL has a variety of commands that can be used to operate on private key files, some of which are specific to RSA (e.g. openssl rsa and openssl genrsa) or which have other limitations. Here we always use

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 28, 2024 13:54
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@sgreben
sgreben / apk flags.md
Created April 13, 2018 13:09
apk flags

apk

apk-tools 2.8.2, compiled for x86_64.

usage: apk COMMAND [-h|--help] [-p|--root DIR] [-X|--repository REPO] [-q|--quiet] [-v|--verbose] [-i|--interactive] [-V|--version] [-f|--force]
           [--force-binary-stdout] [--force-broken-world] [--force-non-repository] [--force-old-apk] [--force-overwrite] [--force-refresh] [-U|--update-cache]
           [--progress] [--progress-fd FD] [--no-progress] [--purge] [--allow-untrusted] [--wait TIME] [--keys-dir KEYSDIR] [--repositories-file REPOFILE]
           [--no-network] [--no-cache] [--cache-dir CACHEDIR] [--arch ARCH] [--print-arch] [ARGS]...
@niw
niw / extract_ttf_from_ttc.rb
Created June 16, 2019 03:25
Extract each font file from TTC font collection file
# See <https://docs.microsoft.com/en-us/typography/opentype/spec/otff#font-collections>
ttc = ARGF
unless ttc.read(4) == "ttcf"
STDERR.puts "Not TTC file."
exit 1
end
major_version, minor_version = ttc.read(4).unpack("nn")