Skip to content

Instantly share code, notes, and snippets.


William G. Comnisky wcomnisky

View GitHub Profile
wcomnisky / php-yield.php
Created Mar 4, 2021
PHP Yield (Generator)
View php-yield.php
ini_set('memory_limit', '4096M');
$timeStart = microtime(true);
$mem = memory_get_usage(true);
function arange($start, $end) {
$array = array();
for ($i = $start; $i <= $end; $i++) {
$array[] = $i;
wcomnisky /
Last active Sep 15, 2021
Install PHP AMQp on MacOS
brew search librabbitmq
brew install rabbitmq-c
pecl install amqp
# set the path to librabbitmq install prefix [autodetect] : /usr/local/Cellar/rabbitmq-c/0.10.0
# if it fails follow the following (reference:
wcomnisky / zsh-iterm2-osx-shortcuts.txt
Created Mar 15, 2020
Terminal shortcuts for Mac terminal
View zsh-iterm2-osx-shortcuts.txt
We all love OSX built-in shortcuts
⌥ + ← or → - move one word backward/forward
⌘ + ← or → - move to beginning/end of line
In zsh you can use ctrl + a/e to move to beginning/end of line and esc + W/B to move one word backward/forward, but that's not very handy.
Here is a solution to map ⌥ + ← / → and ⌘ + ← / → to work in iTerm2 as expected
wcomnisky /
Created Mar 15, 2020
Meld not opening when using it as git difftool on Mac OS
# Credit:
cd ${HOME}
rm -rf ./.local/share/meld
rm -f ./Library/Preferences/org.gnome.meld.plist
rm -rf "./Library/Saved Application State/org.gnome.meld.savedState/"
wcomnisky / eclipse.ini
Created Jan 10, 2019
Fix for Eclipse hangs or freezes constantly
View eclipse.ini
wcomnisky /
Created Mar 7, 2018
USB Stick read-only problem on Linux

Use one of the following to find the USB stick:

  • mount
  • df -Th

Umount it:

  • umount /dev/sd{xn}

Format it:

  • sudo mkfs.vfat /dev/sd{xn}
wcomnisky / Force removal broken packages on Ubuntu
Created Dec 18, 2017
Force removal broken packages on Ubuntu
View Force removal broken packages on Ubuntu
sudo dpkg --remove --force-remove-reinstreq pckgName
wcomnisky / Fix for Eclipse without the toolbar
Last active Dec 18, 2017
Fix for Eclipse without the toolbar
View Fix for Eclipse without the toolbar
Add the following to eclipse.ini after the --launcher.library and its value:
wcomnisky / Eclipse crash
Last active Dec 18, 2017
Eclipse crashing due to
View Eclipse crash
export SWT_GTK3=0
wcomnisky /
Last active Jan 31, 2017
Expect script to SSH-access a machine, login to another user, run x11vnc and close the session after close the VNC client
#!/usr/bin/expect --
# Argument:
# argv0 = host
# Usage:
# ip-or-hostname
spawn ssh -o StrictHostKeyChecking=no -p 22 -L 9000:localhost:5900 user@[lindex $argv 0]