Skip to content

Instantly share code, notes, and snippets.

View Synchro's full-sized avatar

Marcus Bointon Synchro

View GitHub Profile
@Synchro
Synchro / sphp.sh
Created December 20, 2022 22:46 — forked from rhukster/sphp.sh
Easy Brew PHP version switching
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
osx_patch_version=${osx_patch_version:-0}
osx_version=$((${osx_major_version} * 10000 + ${osx_minor_version} * 100 + ${osx_patch_version}))
homebrew_path=$(brew --prefix)
brew_prefix=$(brew --prefix | sed 's#/#\\\/#g')
@Synchro
Synchro / sphp
Last active June 8, 2023 13:36 — forked from rozsival/sphp
Easy Brew PHP-FPM switch
#!/usr/bin/env bash
latest="8.1"
versions=("7.4" "8.0" "$latest")
valid=$(printf "|%s" "${versions[@]}")
switch="$1"
ERROR=$(tput setaf 1)
SUCCESS=$(tput setaf 2)
if [ -z "$switch" ]
@Synchro
Synchro / sfprefix.php
Created January 19, 2017 14:46
Salesforce prefix to entity name mapping
<?php
/**
* Mapping array for salesforce ID prefixes to entity name & description.
* @link http://www.fishofprey.com/2011/09/obscure-salesforce-object-key-prefixes.html
* Convert copy/paste from that page with:
* Search: '^([a-zA-Z0-9]+)[ \t]+(\w+)[ \t]*(.*)$'
* Replace: ' '$1' => ['$2', '$3'],'
* @author Marcus Bointon <[email protected]>
*/
@Synchro
Synchro / add_apache_brew.md
Last active June 18, 2017 22:28 — forked from vitorbritto/add_apache_brew.md
Install Apache with Homebrew

Install Apache with Homebrew

Installing Apache

# Start by stopping the built-in Apache, if it's running, and prevent it from starting on boot.
# This is one of very few times you'll need to use sudo:
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist 2> /dev/null

# Install Apache 2.4 with the event MPM and HTTP/2 support

brew install -v homebrew/apache/httpd24 --with-mpm-event --with-http2

@Synchro
Synchro / # hhvm - 2016-09-20_08-39-45.txt
Created September 20, 2016 06:59
hhvm (hhvm/hhvm/hhvm) on macOS 10.11.6 - Homebrew build logs
Homebrew build logs for hhvm/hhvm/hhvm on macOS 10.11.6
Build date: 2016-09-20 08:39:45
@Synchro
Synchro / hpkp-tlsa.sh
Last active September 12, 2016 09:11 — forked from aeris/hpkp-tlsa.sh
Generate HPKP or TLSA fingerprint
#!/bin/bash
# Uses pkey instead of rsa so it also works with ecc certs
case "$1" in
hpkp)
case "$2" in
key)
openssl pkey -in "$3" -outform der -pubout 2>/dev/null | openssl dgst -sha256 -binary | openssl enc -base64
;;
csr)
openssl req -in "$3" -pubkey -noout | openssl pkey -pubin -outform der 2>/dev/null | openssl dgst -sha256 -binary | openssl enc -base64
@Synchro
Synchro / better.fyi ssl info.md
Last active August 10, 2016 10:16
better.fyi cipher issue

Chrome 54 cipher list (from https://www.ssllabs.com/ssltest/viewMyClient.html):

TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca9)   Forward Secrecy	256
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca8)   Forward Secrecy	256
OLD_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (0xcc14)   Forward Secrecy	256
OLD_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xcc13)   Forward Secrecy	256
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b)   Forward Secrecy	128
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)   Forward Secrecy	128
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (0xc02c)   Forward Secrecy	256
@Synchro
Synchro / openssl_pkcs7_sign_bug.php
Last active August 29, 2015 14:16
Demonstrate incorrect handling of $extracerts default value in openssl_pkcs7_sign PHP function
<?php
$dn = array(
'countryName' => 'UK',
'stateOrProvinceName' => 'Here',
'localityName' => 'There',
'organizationName' => 'PHP',
'organizationalUnitName' => 'PHPTest',
'commonName' => 'PHP Test',
'emailAddress' => '[email protected]'
);
@Synchro
Synchro / gist:dbbe7e80d8dce293c097
Created October 21, 2014 07:07
Dtruss trace of php 5.6 running slowly on OS X
sudo dtruss -e -c -f php -v
PID/THRD ELAPSD SYSCALL(args) = return
30865/0x8a875: 304 thread_selfid(0x0, 0x0, 0x0) = 567413 0
30865/0x8a875: 6 csops(0x0, 0x0, 0x7FFF5B3161C8) = 0 0
30865/0x8a875: 4 issetugid(0x0, 0x0, 0x7FFF5B3161C8) = 0 0
30865/0x8a875: 7 shared_region_check_np(0x7FFF5B314108, 0x0, 0x7FFF5B3161C8) = 0 0
30865/0x8a875: 42 stat64("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x7FFF5B315298, 0x7FFF5B3161C8) = 0 0
30865/0x8a875: 41 open("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x0, 0x0) = 3 0
30865/0x8a875: 24 pread(0x3, "\312\376\272\276\0", 0x1000, 0x0) = 4096 0
30865/0x8a875: 8 pread(0x3, "\317\372\355\376\a\0", 0x1000, 0x1000) = 4096 0
@Synchro
Synchro / chuid
Created October 9, 2014 09:00
Shell script to change a numeric UID and all files it owns
#!/bin/bash
# Change a user's UID and all files owned by them everywhere
# Syntax: chuid <from uid> <to uid>
# Example: chuid 1000 1001
# <From uid> must exist; <to uid> must not exist
# usermod will fail if the <from uid> has any running processes
# - stopping them is left to you
# @author Marcus Bointon <https://gist.github.com/Synchro>
set -e