Skip to content

Instantly share code, notes, and snippets.

@maciakl
maciakl / gist:1584387
Last active February 4, 2023 18:32
Git Workflow
# GIT WORKFLOW
# (c) Luke Maciak
# Initialize:
git init
# Check Out:
git clone username@host:/path/to/repository
@maciakl
maciakl / gist:1663584
Last active September 29, 2015 20:37
Reseting TCP/IP on Windows (because I always forget this).
netsh winsock reset catalog
netsh int ip reset resetlog.txt
@maciakl
maciakl / gist:1664704
Created January 23, 2012 18:32
Reset MySQL Password on Ubuntu
# Stop MySQL
sudo /etc/init.d/mysql stop
# Start MySQL skipping checks
sudo mysqld --skip-grant-tables &
# Log in as root
@maciakl
maciakl / gist:1983010
Created March 6, 2012 02:38
Placing Vim Files Under Source Control
# This is how you prepare your .vim directory to be source controlled across multiple platforms
# On Mac/Linux:
mv .vimrc .vim/
ln -s .vimrc .vim/vimrc
# On Winodws:
@maciakl
maciakl / gist:2406298
Created April 17, 2012 14:28
PHP: Export Query Results to a CSV File
<?php
// (c) 2007 Lukasz Grzegorz Maciak
// Code Snippet ID: 5e8cf864-db67-4a30-9857-2ce8f3fcb1d5
// takes a database resource returned by a query
function csv_from_mysql_resource($resource)
{
$output = "";
$headers_printed = false;
@maciakl
maciakl / MC Cheat Sheet
Last active June 7, 2023 19:45
Midnight Commander Cheat Sheet
Shortcut Description
---------------------------------------------------------------
C-o Drop to the console
* Invert selection on files
A-s Incremental search
A-o Open selected directory in opposite panel
A-. Toggle "Show Hidden Files" feature
A-Enter Put name of the highlighted file on command line
@maciakl
maciakl / gist:3666289
Created September 7, 2012 13:34
URL Validation Regex of Doom
(?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\.
)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:\.(?:\d+)
){3}))(?::(?:\d+))?)(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F
\d]{2}))|[;:@&=])*)(?:/(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{
2}))|[;:@&=])*))*)(?:\?(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{
2}))|[;:@&=])*))?)?)|(?:ftp://(?:(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?
:%[a-fA-F\d]{2}))|[;?&=])*)(?::(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-
fA-F\d]{2}))|[;?&=])*))?@)?(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-
)*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?
:\d+)(?:\.(?:\d+)){3}))(?::(?:\d+))?))(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!
@maciakl
maciakl / gist:3827188
Created October 3, 2012 14:24
Compiling Vim 7.3 from source with no root
#!/bin/bash
mkdir ~/local
mkdir ~/build
export TARGET_DIR="$HOME/local"
cd ~/build
hg clone http://hg.debian.org/hg/pkg-vim/vim
cd vim
@maciakl
maciakl / gist:3900724
Created October 16, 2012 17:27
Pine Tricks:
Attaching a Message
-------------------
1. ^R in email body
2. ^W to attach a message
3. Type in message number and Enter
Delete All in Folder
--------------------
@maciakl
maciakl / gist:4119416
Last active June 20, 2019 15:01
Using Stow
# install app
tar -xf app-1.1.tar
cd app-1.1
./configure --prefix=/usr/local/stow/app-1.1
make install
cd /usr/local/stow
sudo stow --verbose=3 app-1.1
# remove
cd /usr/local/stow