Skip to content

Instantly share code, notes, and snippets.

View mystix's full-sized avatar

Marc mystix

  • Singapore
View GitHub Profile
@mystix
mystix / Xero-ClientCredentials-Workaround-2020
Created August 27, 2020 07:19 — forked from channeladam/Xero-ClientCredentials-Workaround-2020
Xero client_credentials workaround - January 2020
Here is a workaround for the lack of a client credentials flow in Xero's OAuth 2.0 / OpenID Connect implementation.
From Xero's FAQ: https://developer.xero.com/faq/all/oauth-private
"Is there an equivalent of two-legged private apps in OAuth 2.0?
No, all users will follow the same OAuth 2.0 code flow.
Once you have an access token and refresh token you can refresh indefinitely or until the token is revoked by the user."
Workaround:
1. Login to Xero as the Xero user to use for the machine-to-machine flow workaround.
@mystix
mystix / sphp.sh
Last active April 30, 2019 07:54 — forked from rhukster/sphp.sh
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
brew_prefix=$(brew --prefix | sed 's#/#\\\/#g')
brew_array=("5.5","5.6","7.0","7.1","7.2", "7.3")
php_array=("php@5.5" "php@5.6" "php@7.0" "php@7.1" "php@7.2" "php@7.3")
php_installed_array=()
php_version="php@$1"
@mystix
mystix / mysql2-mojave.md
Created April 15, 2019 06:50 — forked from fernandoaleman/mysql2-mojave.md
Install mysql2 on MacOS Mojave

Problem

Installing mysql2 gem errors on MacOS Mojave.

Solution

Make sure openssl is installed on Mac via Homebrew.

brew install openssl
@mystix
mystix / countdown.sh
Last active January 23, 2019 01:26 — forked from krohne/countdown.sh
Countdown timer in bash shell script
#!/bin/bash
# $1 = # of seconds
# $@ = What to print after "Waiting n seconds"
countdown() {
secs=$1
shift
msg=$@
while [ $secs -gt 0 ]
do
printf "\r\033[KWaiting %.d seconds $msg" $((secs--))
@mystix
mystix / cron.sh
Created March 31, 2018 04:50
[OSX] Cron + zsh + rbenv
*/15 * * * * $(which zsh) -lc 'export PATH=/usr/local/bin:/usr/local/sbin:$PATH; eval "$(rbenv init -)"; ruby SOME_SCRIPT.rb'
@mystix
mystix / download-portable-apps.ps1
Last active February 7, 2018 17:11
Powershell: Download Portable Apps Platform to Desktop
# adapted from https://blog.jourdant.me/post/3-ways-to-download-files-with-powershell
$version = "14.4.3"
$url = "http://download3.portableapps.com/portableapps/pacplatform/PortableApps.com_Platform_Setup_$version.paf.exe"
$output = "$home\Desktop\paf.exe"
Import-Module BitsTransfer
Start-BitsTransfer -Source $url -Destination $output
@mystix
mystix / RDS_INSTALL.bat
Last active June 19, 2023 01:42 — forked from anthonyeden/RDS_INSTALL.bat
Let's Encrypt & Microsoft Remote Desktop (Windows Server 2016) - Installation Script
@echo off
"C:\Program Files\letsencrypt-win-simple\letsencrypt.exe" --renew --baseuri "https://acme-v01.api.letsencrypt.org/"
REM run powershell script, bypassing security warnings for 3rd-party script
powershell -ExecutionPolicy bypass -File "C:\Program Files\letsencrypt-win-simple\RDS_INSTALL_CERT.ps1"
@mystix
mystix / encrypt_decrypt.rb
Created December 11, 2017 15:24 — forked from wteuber/encrypt_decrypt.rb
Simply encrypt and decrypt Strings in ruby.
require 'openssl'
class String
def encrypt(key)
cipher = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC').encrypt
cipher.key = Digest::SHA1.hexdigest key
s = cipher.update(self) + cipher.final
s.unpack('H*')[0].upcase
end
{"date":"2016-02-12","deliveries":{"100197465":{"assign_to":"Azhar","delivery_time":"3pm - 6pm","postal_code":"576962","dispatched":true},"100197161":{"assign_to":"William","delivery_time":"9am - 12pm","postal_code":"150092","dispatched":true},"100197308":{"assign_to":"Azhar","delivery_time":"9am - 12pm","postal_code":"531984","dispatched":true},"100197033":{"assign_to":"William","delivery_time":"12pm - 3pm","postal_code":"138533","dispatched":true},"100197576":{"assign_to":"Steven","delivery_time":"3pm - 6pm","postal_code":"791447","dispatched":true},"100196820":{"assign_to":"Khoo","delivery_time":"6pm - 9pm","postal_code":"680682","dispatched":true},"100197198":{"assign_to":"Khoo","delivery_time":"9am - 12pm","postal_code":"680295","dispatched":true},"100197673":{"assign_to":"Azhar","delivery_time":"6pm - 9pm","postal_code":"760235","dispatched":true},"FL007456":{"assign_to":"William","delivery_time":"12pm - 3pm","postal_code":"","dispatched":true},"100197680":{"assign_to":"Hanapiah","delivery_time":"12pm -
@mystix
mystix / magento.conf
Created October 14, 2015 05:08 — forked from jonathonbyrdziak/magento.conf
A configuration file for magento under nginx.
#####################################################
#
# Provided by the Magento Support Center
# http://magentosupport.help/knowledgebase/configuring-nginx-to-work-with-magento-advanced/
#
# Your Magento Tutorial specialists
#
server {
listen *:8080;
server_name fanatik.redrokk.com www.fanatikbike.com fanatikbike.com;