Skip to content

Instantly share code, notes, and snippets.

View michfield's full-sized avatar

Michael Field michfield

View GitHub Profile
@michfield
michfield / gist:3918645
Last active October 11, 2015 20:58
Simple way to delete all mail, from CLI

Simple as typing in terminal:

mail
d*
q

That's it.

@michfield
michfield / *.md
Last active December 10, 2015 22:38
Warning grants.sql #chef

This must be AFTER including recipe mysql::server

Chef: Message at compile phase that looks like a warning:

INFO: Could not find previously defined grants.sql resource

Solution: Suppress that message

It is from opscode/mysql Cookbook because some template resource is not specified. So, to solve, just copy the code from recipe, before including opscode/mysql cookbook

@michfield
michfield / *.md
Last active December 10, 2015 22:48
Windows command line completion #windows

Add command line completion to Windows in two copy-paste steps

(
echo/@echo off
echo/:: History alias is assuming you are using clink with default clink profile location
echo/doskey history=cat "%LOCALAPPDATA%\clink\.history" $*
echo/doskey l=ls -CF --color=auto $*
echo/doskey la=ls -A --color=auto $*
echo/doskey ll=ls -alF --color=auto $*
@michfield
michfield / gist:4525251
Last active July 25, 2021 05:41
Clone all GitHub repositories of a user #bash
@michfield
michfield / *.bat
Last active October 1, 2019 03:11
The only way to install ZeroMQ in Windows
:: Download ZeroMQ for Windows [Installers for Microsoft Windows](http://www.zeromq.org/distro:microsoft-windows)
:: Use only 32bit install, even on 64bit Windows and only 2.2.0 version (not 3.x)
:: Make sure you're not using the 3.x beta version of zeromq - you must use the official 2.x libs
ZeroMQ-<whatever>.exe /S /D=c:\tools\zeromq && echo ZeroMQ for Windows installed
:: DLL must be renamed
copy c:\tools\zeromq\bin\libzmq-v100-mt.dll c:\tools\zeromq\bin\libzmq.dll
:: Install Ruby Gem zmq
@michfield
michfield / *.bat
Last active September 11, 2017 14:38
Install Gems without documentation #ruby #windows
:: Make --no-ri --no-rdoc default gem install options (without documentation)
:: Possible variations:
:: For every user:
:: echo gem: --no-ri --no-rdoc > "%PROGRAMDATA%\gemrc"
:: Only for you
:: echo gem: --no-ri --no-rdoc >> "%USERPROFILE%\.gemrc"
::
:: Note: In Windows, %PROGRAMDATA% is /etc on Linux
::
:: But finally, the best way to do it. See: http://stackoverflow.com/a/7662245/1579985
@michfield
michfield / *.md
Last active December 12, 2015 01:38
Fix Vagrant about environment variables #vagrant

Batch file vagrant.bat sets both GEM_HOME and GEM_PATH environment variables. It would be nice of him to restore old values after finishing it's work.

Something like:

:: Save variables
SET "GEM_HOME_SAVED=%GEM_HOME%"
SET "GEM_PATH_SAVED=%GEM_PATH%"
@michfield
michfield / *.md
Last active December 16, 2015 15:19
How to change Start menu button keyboard shortcut in Linux Mint?

Linux Mint has something called MintMenu button that has a functionality similar to the Start button in Windows.

To define keyboart shortcut for this button, we need to right-click on the MintMenu button on the panel and from the dropdown to click on Preferences. Change the keyboard shortcut there.

Log out and back in, to see effects of changes made.

Recursively convert text files from DOS to Unix line-endings
Type in Windows command line:

for /r "miscellaneous" %x in ("*") do @dos2unix --d2u --verbose --skipbin "%x"

@michfield
michfield / .md
Last active December 16, 2015 16:19

Using variables, also called repeated nodes in YAML, but in JSON variant of YAML format. I'm using this for the whole subtree. Great!

{
  "original": &VAR
  {
    "x": "Value x",
    "subtree":
    {
      "y": "Value Y"