Skip to content

Instantly share code, notes, and snippets.

View wcomnisky's full-sized avatar
💻

William Comnisky wcomnisky

💻
View GitHub Profile
@wcomnisky
wcomnisky / README.md
Created November 29, 2023 22:10
Configuring vscode as Git diff tool

If you are using Visual Studio Code Insiders (for early adopters) you may need to have a vscode instance/window already running before running your difftool, otherwise it may crash once you finish reviewing the first file (when you have more than one file to check diffs)

git config --global diff.tool vscode
git config --global difftool.vscode.cmd 'code --wait --diff $LOCAL $REMOTE'
@wcomnisky
wcomnisky / README.md
Created November 23, 2023 22:09
New Relic logs parsing

New Relic Logs Parsing

To create a log parsing rule follow the steps below.

  • Access https://one.newrelic.com/logger/log-parsing
  • Hit the "Create parsing rule" button
  • Fill in the fields:
    • Name as you like
    • Field to parse any field available in the logs; usually the message
  • Filter logs based on NRQL examples:
@wcomnisky
wcomnisky / .gitconfig
Created July 17, 2022 10:06
Basic Git Config ~/.gitconfig
[user]
# Please adapt and uncomment the following lines:
name = William Comnisky
email = w.comnisky@gmail.com
[diff]
tool = meld
guitool = meld
[merge]
tool = meld
[difftool]
@wcomnisky
wcomnisky / php-yield.php
Created March 4, 2021 08:36
PHP Yield (Generator)
<?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 October 27, 2023 12:16
Install PHP AMQp on MacOS
#!/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 March 15, 2020 11:41
Terminal shortcuts for Mac terminal
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 March 15, 2020 11:16
Meld not opening when using it as git difftool on Mac OS
#!/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 January 10, 2019 00:30
Fix for Eclipse hangs or freezes constantly
-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 March 7, 2018 22:58
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
wcomnisky / Force removal broken packages on Ubuntu
Created December 18, 2017 04:11
Force removal broken packages on Ubuntu
sudo dpkg --remove --force-remove-reinstreq pckgName