Skip to content

Instantly share code, notes, and snippets.

View mattgd's full-sized avatar

Matt Dzwonczyk mattgd

View GitHub Profile
@mattgd
mattgd / .bash_profile
Created November 28, 2018 02:13
dotfiles
# Aliases for NeoVim
alias vim="nvim"
alias vi="nvim"
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
# Set CLICOLOR if you want Ansi Colors in iTerm2
export CLICOLOR=1
# Set colors to match iTerm2 Terminal Colors
@mattgd
mattgd / find_exceptions.py
Created May 1, 2018 20:44
Search log directory for logs with Java exceptions in them.
import os
import sys
import gzip
import re
except_match = re.compile(r'^(?!.*Werror).*(?:exception|error|warning|Segmentation)')
def has_exception(content):
return except_match.search(content)
@mattgd
mattgd / settings.json
Last active March 14, 2018 22:22
Visual Studio Code User Settings
{
"workbench.startupEditor": "newUntitledFile",
"workbench.colorTheme": "Dracula",
"files.associations": {
"*.jinja": "html"
},
"workbench.editor.enablePreview": false,
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.detectIndentation": true,
@mattgd
mattgd / pretty_request.py
Created October 12, 2017 23:17
Prints a Django HTTP request nicely for debugging.
def pretty_request(request):
headers = ''
for header, value in request.META.items():
if not header.startswith('HTTP'):
continue
header = '-'.join([h.capitalize() for h in header[5:].lower().split('_')])
headers += '{}: {}\n'.format(header, value)
return (
'{method} HTTP/1.1\n'
@mattgd
mattgd / vimrc
Last active January 15, 2018 15:30
My Vim configuration.
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
@mattgd
mattgd / reset_auto_increment.txt
Created June 11, 2017 00:48
SQL commands to reset a table's auto increment values to consecutive integers.
SET @count = 0;
UPDATE `users` SET `users`.`id` = @count:= @count + 1;
ALTER TABLE `users` AUTO_INCREMENT = 1;
@mattgd
mattgd / ajax_debug.js
Last active October 23, 2018 21:49
AJAX Request Debug Example
$.ajax({
url: 'submit.php',
data: $(this).serialize(),
type: 'POST',
dataType: 'json',
success: function(data) {
if (data.status == 0) {
alert('You are offline!\nPlease check your network connection.');
} else if (data.status == 404) {
alert('Requested URL not found.');