Skip to content

Instantly share code, notes, and snippets.

View JoshuaEstes's full-sized avatar
👨‍💻

Joshua Estes JoshuaEstes

👨‍💻
View GitHub Profile
@JoshuaEstes
JoshuaEstes / vim
Created December 12, 2011 21:10
vim sudo write
:w !sudo tee % > /dev/null
@JoshuaEstes
JoshuaEstes / search_and_replace.pl
Created December 13, 2011 17:29
command line function to search and replace text
perl -p -i -e 's/oldstring/newstring/g' `find ./ -name "*.html"`
@JoshuaEstes
JoshuaEstes / git_rm.sh
Created January 27, 2012 03:16
Bash one liner to remove all the files from git repo that are marked as deleted
for file in $(git ls-files --deleted); do git rm "$file"; done
@JoshuaEstes
JoshuaEstes / ircbot.php
Created February 1, 2012 16:47
shitty irc bot to fire jarvis
<?php
/**
*
*/
set_time_limit(0);
ini_set('display_errors', 'on');
class jBot {
@JoshuaEstes
JoshuaEstes / mysqlformatter.sed
Created February 8, 2012 21:03
Takes a mysqldump output and converts some of the values and breaks up "(values),(values),(values);" into "(values),\n(values)\n(values);"
sed -ri 's/(\([^\)]+\),)/&\n/ig' dump.sql
@JoshuaEstes
JoshuaEstes / cope.php
Created April 22, 2012 23:18
Break apart an html string, keep the tags and positions
<?php
$text = <<<EOF
<p>there is more to it <i>than</i> this.</p>
<div class="test">more test stuff.</div>
<p>Last bit of text in a paragraph.</p>
<p>Continuing to test this.</p>
EOF;
$plainText = strip_tags($text);
@JoshuaEstes
JoshuaEstes / 000-Cheat-Sheets.md
Last active May 1, 2024 04:03
Developer Cheat Sheets for bash, git, gpg, irssi, mutt, tmux, and vim. See my dotfiles repository for extra info.
@JoshuaEstes
JoshuaEstes / move-repo.sh
Created May 14, 2012 19:07
Bash script to move git repo from one server to another
#!/usr/bin/env bash
# Repositories
repos=(
CrappyRepo-name-OnE
Crappy--rePO-name-2
)
# Rename repos, if you aren't
# renaming repos, then just
@JoshuaEstes
JoshuaEstes / mysqldump.sh
Created May 29, 2012 14:43
mysql dump snippet, will output a sql file with the date and time of the dump
mysqldump -u USERNAME -p DATABASE_NAME > $(date +"%m-%d-%y_%H-%M%p").sql
@JoshuaEstes
JoshuaEstes / port-uninstall.sh
Created June 2, 2012 15:47
using mac ports to uninstall something?
port uninstall --follow-dependents ncurses