Skip to content

Instantly share code, notes, and snippets.

@ds0nt
Last active September 3, 2015 07:57
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ds0nt/e9cb82f2904c60346b53 to your computer and use it in GitHub Desktop.
Save ds0nt/e9cb82f2904c60346b53 to your computer and use it in GitHub Desktop.
Awesome bash hacks --- (for web devs & ninjas, for dot-file pride, for pleasing the monospace gods )
#### #### #### #### #### ####
# / ! /
# / e /
# / M /
# / /
# / k /
# / r /
# / o /
# F /
# /
# /
#
# js friendly tree
src-tree()
{
tree -I node_modules
}
# destroy all docker containers..
docker-purge()
{
docker ps -aq | while read x; do docker stop $x; docker rm $x; done
}
# customized bashrc per project -- for project-related aliases and tasks!
# for instance: https://github.com/kloudsio/klouds/blob/master/.bashrc-klouds
foo-bash()
{
bash --rcfile /code/foo/.bashrc-foo
}
#
# Let's start a collection. :)
#
@ds0nt
Copy link
Author

ds0nt commented Sep 2, 2015

/code/asg $ src-tree
.
|-- api.js
|-- cli.js
|-- config
|   `-- redis.json
|-- example
|   |-- config
|   |   |-- layout.yml
|   |   `-- test-config
|   `-- templates
|       |-- layout.hbs
|       |-- layout2.hbs
|       `-- test-template
|-- lib
|   |-- core.js
|   |-- loaders
|   |   |-- folder.js
|   |   `-- redis.js
|   `-- mini-api.js
|-- package.json
`-- tests.js

@ds0nt-star-bot
Copy link

Employing use of a customized .bashrc tailored for a particular project has been rather fun.

Alias or keybind project-related scripts, tasks, deploys, ssh & workflow stuff (especially in front-end dev -- oh god)

bash --rcfile /code/foo/.bashrc-foo
# or in my case
klouds-bash()
{
  xfce4-terminal --command='bash --rcfile /code/klouds/.bashrc-klouds'
}

$ klouds-bash opens bash with a customized .bashrc that increases keystroke potency!

Example Output

 #  #   ######## ######            ###### ########   #  # 
### ## #####  ### ###     klouds     ##  ###  ##### ## ###
 #  #   ######## ##                    ## ########   #  # 

/code/klouds $ 
/code/klouds $ client watch   # runs client scripts | server <scr> would do server | # :) I feel clever
Thu Sep 03 2015 07:55:44 - Running action...
Thu Sep 03 2015 07:55:44 - watching directory: ./src
Thu Sep 03 2015 07:55:44 - watching: ./src/api.js
Thu Sep 03 2015 07:55:44 - watching: ./src/app.js

@ds0nt-star-bot
Copy link

xclip + shell scripts + keybound = clipboard hacks

# ouputs your clipboard contents
xclip -o

# github clone hotkey

REPO=`xclip -o`
SLUG=`echo $REPO | cut -d/ -f 4-`
git clone $REPO /github/`xclip -o | cut -f -2`


# scrape urls from a page? <or maybe / emails / color scheme>
curl "`xclip -o`" | grep -E -o 'href="http[^"]*' | cut -c 7- 

# https://gist.github.com/fluidicon.png
# https://assets-cdn.github.com/
# https://assets-cdn.github.com/pinned-octocat.svg
# https://assets-cdn.github.com/favicon.ico
# ....


# Imagine the possibilities!
# gist, dropbox, codepen, add trello cards.. call apis.. copy to editor.. eval things in containers.. save things in dbs, email to self, paste as cron job, relabel your partition. ? :O

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment