Skip to content

Instantly share code, notes, and snippets.

View micahblu's full-sized avatar

Micah Blu micahblu

View GitHub Profile
@micahblu
micahblu / gist:6b3a220f53bda40e7d6d
Created March 9, 2015 17:56
search and replace all filenames
find . -name '*.scss' -exec bash -c 'mv "$1" "${1/.scss/.less}"' -- {} \;
@micahblu
micahblu / gist:312cd787051e2879d521
Created March 18, 2015 17:19
Make duplicate .htm files from .html files
find . -name "*.html" -exec bash -c 'cp "$1" "${1/.html/.htm}"' -- {} \;
@micahblu
micahblu / gist:cc60696d77bdcab4be9f
Created November 23, 2015 22:35
Checking for running service, start it if not
#!/bin/bash
service=replace_me_with_a_valid_service
if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is running!!!"
else
/etc/init.d/$service start
fi
@micahblu
micahblu / ~
Last active October 3, 2018 15:56
console log print method, for cases where console log doesn't expand consoled objects
const print = (obj, log=true) => {
let tab = ` `;
let tabs = [tab];
let output = '';
const quotify = (value) => typeof value === 'string' ? `"${value}"` : value;
const _print = (_obj) => {
let output = '';
for (let prop in _obj) {
if (!_obj.hasOwnProperty(prop)) continue;
@micahblu
micahblu / gist:08c86f215fc303e9827b0cf5a93bc40b
Created February 1, 2020 21:27
bash script to create local git branches from remote branches
for i in `git branch -a | grep remote | grep -v HEAD | grep -v master`; do git branch --track ${i#remotes/origin/} $i; done