Skip to content

Instantly share code, notes, and snippets.

@Sydney-o9
Sydney-o9 / install-php-on-mac-os-from-source.sh
Last active October 16, 2023 03:37
Install PHP on Mac OSX from source
cd /tmp && \
wget http://au1.php.net/distributions/php-5.6.12.tar.gz -O php-current.tar.gz > /dev/null 2>&1
mkdir php-current && tar -zxvf php-current.tar.gz -C /tmp/php-current --strip-components=1 > /dev/null 2>&1 && \
cd php-current
./configure \
--with-apxs2=/usr/sbin/apxs \
--with-mysql \
--with-mysqli \
@Sydney-o9
Sydney-o9 / install-mongodb-mac-os-x.md
Last active June 30, 2023 08:58
Install MongoDB on Mac OS X without brew

1. Download latest source

# Get latest from MongoDB website
$ curl -O https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-3.4.6.tgz
$ tar -zxvf mongodb-osx-x86_64-3.4.6.tgz
$ mkdir -p mongodb
$ cp -R -n mongodb-osx-x86_64-3.4.6/ mongodb
$ sudo mv mongodb /usr/local
@Sydney-o9
Sydney-o9 / json-date.swift
Created July 16, 2017 08:00
SWIFT: Create Json string from Date
let dateFormatter = DateFormatter()
let enUSPosixLocale = Locale(identifier: "en_US_POSIX")
dateFormatter.locale = enUSPosixLocale
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
let createdDate = dateFormatter.string(from: Date())
@Sydney-o9
Sydney-o9 / machine.js
Created August 28, 2020 05:58
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
# @Author Jobinhood
BV_GREEN_TICK='\e[0;32m [✔] \e[0m';
BV_RED_CROSS='\e[0;91m [✗] \e[0m';
BV_YELLOW_DOT='\e[0;33m [.] \e[0m';
BV_YELLOW_DOTS='\e[0;33m ... \e[0m';
# Helper to run sudo commands for us by asking
# sudo password if needed
sudo_needed() {
# Start Selenium server
start_selenium
# stop Selenium server
stop_selenium
# Status for Selenium server
status_selenium
status_selenium -v
# Start Selenium
sudo launchctl load /Library/LaunchDaemons/org.seleniumhq.selenium.plist
# Stop Selenium
sudo launchctl unload /Library/LaunchDaemons/org.seleniumhq.selenium.plist
# Is it working?
ps -ef | grep selenium | grep java | grep chromedriver | grep -v grep | grep -c selenium
# Will show 0 if selenium is not running, and 1 otherwise
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.seleniumhq.selenium</string>
<key>UserName</key>
<string>_selenium</string>
<key>ProgramArguments</key>
<array>
# Create plist file in /Library/LaunchDaemons
vi /Library/LaunchDaemons/org.seleniumhq.selenium.plist
# Start Selenium
java -Dwebdriver.chrome.driver=/usr/local/selenium/drivers/chromedriver -jar /usr/local/selenium/bin/selenium-server-standalone-3.8.1.jar
# Make sure it works
ps -ef | grep selenium | grep -v grep