Skip to content

Instantly share code, notes, and snippets.

View mattmccarty's full-sized avatar

Matt McCarty mattmccarty

  • Orlando, Florida
View GitHub Profile
# Clean docker images older than 30 days
# Source: https://stackoverflow.com/questions/50737059/how-to-remove-docker-images-which-created-7-days-ago-automatically/50737737#50737737
docker image prune -a --filter "until=$(date +'%Y-%m-%dT%H:%M:%S' --date='-30 days')"
extern crate kernel32;
extern crate winapi;
use std;
use self::winapi::{STD_OUTPUT_HANDLE, INVALID_HANDLE_VALUE, CONSOLE_SCREEN_BUFFER_INFO, HANDLE, HMODULE, LOBYTE, LOWORD, WORD, DWORD, WCHAR, FARPROC, NTSTATUS };
use self::winapi::winnt::OSVERSIONINFOW;
use self::kernel32::{GetStdHandle,GetConsoleMode,SetConsoleTextAttribute,GetVersion,GetVersionExW,GetModuleHandleW,GetProcAddress};
use std::os::windows::ffi::OsStrExt;
use std::ffi::OsStr;
@mattmccarty
mattmccarty / terminal-dir-colors
Last active August 9, 2017 13:25
Adds colors to directories and files in the linux terminal
#
# The snippet below was taken from the "Solarized" terminal profile theme
# @see: https://github.com/Anthony25/gnome-terminal-colors-solarized
# I use this snippet with the 'One Dark' terminal theme:
# @see: https://github.com/denysdovhan/one-gnome-terminal
# On Fedora/CentOS (or other major distros), add the snippet below to ~/.dir_colors
# If it doesn't work, move the file to ~/.dir_colors/dircolors.
# If after that it still doesn't work, add the following to the ~/.bashrc:
#
# if [ -f ~/.dir_colors/dircolors ]
@mattmccarty
mattmccarty / git-log-beautifier
Created March 20, 2017 21:20
Beautify the output of git-log
# Issue the command below:
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
# When you want to beautify the git log, use the following command:
git lg
# Reference:
https://coderwall.com/p/euwpig/a-better-git-log
@mattmccarty
mattmccarty / sublime-3-maven-build
Created March 8, 2017 00:40
Maven Build System for Sublime Text 3
#
# Tools -> Build System -> New Build System
# Paste the snippet below in the file that opens
# Save as "Maven.sublime-build" in ~/.config/sublime-text-3/Packages/User
# Ctrl+Shift+P will show all maven commands in snippet below if you start to type "Maven"
# Open a pom.xml file and execute a command
#
{
"working_dir": "$file_path",
"shell_cmd":"mvn clean install",
@mattmccarty
mattmccarty / fedora-prompt-color
Created January 29, 2017 17:36
Add ubuntu/mint like colors to the shell prompt
# Put this in ~/.bashrc after the /etc/bashrc is included
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
@mattmccarty
mattmccarty / git-timestamp-commit
Created July 26, 2016 21:24
Git - Timestamp for Merge/Commit
git rev-list --format=format:'%ci' --max-count=1 `git rev-parse {commit-id}`
@mattmccarty
mattmccarty / ssh-public-and-private-keys
Last active August 14, 2017 00:38
SSH Without Password
# Locally, Run ssh-keygen.
# When prompted, enter the directory and a unique name for the key to be stored in (i.e: /home/user/.ssh/id_rsa_work)
# When prompted hit enter twice to set an empty password
ssh-keygen
# Locally, Run ssh-copy-id. When prompted enter remote user's password
ssh-copy-id -i ~/.ssh/id_rsa_work.pub remote_user@ip-addr-or-hostname
#
# You should a message similar to the following