jaymon / .bash Goto Github PK
View Code? Open in Web Editor NEWcommon bash functions and aliases I've written/accumulated over the years
common bash functions and aliases I've written/accumulated over the years
then have all add the bin/ directory to the path, so any of the scripts and apps can be easily ran.
I configured my terminal prompt to give me an emoji based on whether the last command was successful or not so I can see at a glance!
the responses have links to how to do it.
I have notes on my findings in sysadmin/vagrant/parallels-configuration/_NOTES.md
The biggest problem is it seems bento boxes seem to share the same machine-id which messes up the DHCP leases that parallels gives you and puts Vagrant in a bad state. For example, I can run:
$ cat /Library/Preferences/Parallels/parallels_dhcp_leases
[vnic0]
10.211.55.3="1675109922,1800,001c42cc5e4c,ff0824450a00020000bb113754a24acdf09cbb"
But I actually have two bento 20.04 boxes up and running. And they both seem to be running, because I can talk to the db of the second box through the forwarded port, but I can't ssh into it, in fact, I can't run vagrant ssh
in either of the directories and ssh into the boxes, I have to ssh into them directly:
$ ssh [email protected]
And that's only for the first box, as far as I can tell, I can't ssh into the second box at all, it's just up and running with no way to get into it.
I need to get sshv
working for parallels, basically parsing the parallels_dhcp_leases
file for the ip addresses. ff0824450a00020000bb113754a24acdf09cbb
doesn't seem to correspond to the box ids found running vagrant status
though, so I'll have to poke around and see what I can find
I feel like I can do something with this but I don't know what yet, but I wanted to remember this is a thing I can customize:
search: bash override "command not found"
I think these can all be redone in python to make them more full-featured, both the environment stuff and the pypi tools, I liked the name pie
but sadly it's taken.
pye
might be an okay name
This would be nice to check help on files that aren't in the .bash directory
jaymon:~/Projects/FirstOpinion/_proxi (master) $ d pro
[1] /blah/Projects/foo
...
[18] /blah/Projects/bar
[n] None
Choice? 15
Didn't actually open number 15, figure out why
It would be kind of cool to be able to run a command that would grab all open tabs and urls and convert them to:
[<TAB TITLE>](<TAB URL>)
I could modify this applescript: Getting a text file with the url of open tabs:
tell application "Safari"
-- Count the number of Windows
set numWindows to number of windows
repeat with w from 1 to numWindows
--Count the number of Tabs
set numTabs to number of tabs in window w
repeat with t from 1 to numTabs
-- Set the Tab Name and URL values
set tabName to name of tab t of window w
set tabURL to URL of tab t of window w
-- Create the Tab link and write the code
set output to output & " <a href=\"" & tabURL & "\">" & tabName & "</a>" & linefeed as string
end repeat
end repeat
end tell
-- Close out the HTML document
set output to output & "</body>
" & "</html>
"
-- Write the entire HTML document to TextEdit
tell application "TextEdit"
activate
make new document
set the text of the front document to output
end tell
To work with Chrome.
it would be cool to be able to run some command and get the pwd of each shell and display them so I can quickly have another iterm get to a current directory.
allow customizing the environment similar to how I set the background, so I could add an environ.sh file and it would be sourced upon entering the directory
it will look at the .git/config
and find the url and convert that to a visitable link and open it in the browser
Here's a bitbucket one:
url = [email protected]:Username/repo.git
really all my code grep commands should read in the .gitignore
file and filter results that match that file, so if I have build/
in my .gitignore
then it shouldn't return any results from that directory.
there should be a generic function everytime the status line is printed that can take a path to a script from the environment and run it, this will save me the time of having to keep adding custom functions for the most part for all my hooks.
add pytouch that will cp a template file to the current directory, so:
$ pytouch foo.py
would basically:
$ cp $TEMPLATE_FILE foo.py
I think the qcd command should become a little more fully featured, so:
$ qcd recent
Would display the most recent directories
$ qcd saved
Would display the ones that are explicitly saved (which is current functionality). And
$ qcd visited
would display the most visited.
So the idea would be to have qcd run every time the prompt is printed and then track the directories.
Directories could be tracked by greping for the directory in a file with format
N /path
So you would grep and cut to find N, then increment it and then append that path back on the bottom (removing it from anywhere else in the list by using grep -N). So to display the most recent you just tail the file, to display the most you just sort the file.
lots of times I want to update a module from github, and everytime I have to look up the syntax and copy paste, what I would love is a small script that will find the current module in python's site packages (or the virtual env) and load its setup.py and get the url and current version, if it is a github url it will make this request:
pip install git+https://github.com/NAME/PROJECT#egg=NAME>CURRENT_VERSION
so instead of having to look up the url (which I just had to again by the way) I could just do:
pip-update NAME
and have it do all the heavy lifting.
something like:
cp $PY_SITECUSTOMIZE_PATH venv/lib/python2.7/sitecustomize.py
pypa/virtualenv#629
http://stackoverflow.com/questions/10693706/creating-a-secondary-site-packages-directory-and-loading-packages-from-pth-fil
I would also be cool if invoking pyenv
also sourced venv/environment.sh
so you could edit that to add custom environment variables for the project
NOTE Everything below is iTerm (iTerm2) specific!
you can get close to this with this command:
$ open . -a iTerm
But it opens a new tab.
I tried Applescript:
/usr/bin/osascript \
-e 'tell application "iTerm" to activate' \
-e 'tell application "System Events" to tell process "iTerm" to keystroke "n" using command down'
But I'm getting errors like:
Not authorized to send Apple events to iTerm
Not authorized to send Apple events to System Events
I've tried to add the right permissions in the Security and Privacy settings but I can't find a way to add permissions to iTerm under the automation section.
You can also go into iTerm's profile and click "edit profile", go to the Window tab and select "Open in a new window, never in a tab" but that seems like overkill, it feels like there must be a way to tell iTerm to do this programmatically, I tried passing in various flags using open but none of them have an effect, things like:
$ open . -a iTerm --args -n
Things that might be helpful:
search:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.