Skip to content

Instantly share code, notes, and snippets.

Avatar
💻

William G. Comnisky wcomnisky

💻
View GitHub Profile
@wcomnisky
wcomnisky / php-yield.php
Created Mar 4, 2021
PHP Yield (Generator)
View php-yield.php
<?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
wcomnisky / install-php-amqp.sh
Last active Sep 15, 2021
Install PHP AMQp on MacOS
View install-php-amqp.sh
#!/bin/bash
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: https://github.com/pdezwart/php-amqp/issues/355#issuecomment-563203121):
@wcomnisky
wcomnisky / zsh-iterm2-osx-shortcuts.txt
Created Mar 15, 2020
Terminal shortcuts for Mac terminal
View zsh-iterm2-osx-shortcuts.txt
Source: https://coderwall.com/p/a8uxma/zsh-iterm2-osx-shortcuts
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
wcomnisky / clean-meld-settings.sh
Created Mar 15, 2020
Meld not opening when using it as git difftool on Mac OS
View clean-meld-settings.sh
#!/bin/bash
# Credit: https://github.com/yousseb/meld/issues/70#issuecomment-425686670
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
wcomnisky / eclipse.ini
Created Jan 10, 2019
Fix for Eclipse hangs or freezes constantly
View eclipse.ini
-startup
plugins/org.eclipse.equinox.launcher_1.5.100.v20180827-1352.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.800.v20180827-1352
-product
org.eclipse.epp.package.rcp.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
@wcomnisky
wcomnisky / README.md
Created Mar 7, 2018
USB Stick read-only problem on Linux
View README.md

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
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
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:
--launcher.GTK_version
2
@wcomnisky
wcomnisky / Eclipse crash
Last active Dec 18, 2017
Eclipse crashing due to libgtk-3.so.0
View Eclipse crash
export SWT_GTK3=0
./eclipse
@wcomnisky
wcomnisky / expect-x11vnc.sh
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
View expect-x11vnc.sh
#!/usr/bin/expect --
# Argument:
# argv0 = host
#
# Usage:
# expect.sh ip-or-hostname
spawn ssh -o StrictHostKeyChecking=no -p 22 -L 9000:localhost:5900 user@[lindex $argv 0]