Monday, April 20, 2020

3000 Up - May Not All Be Visible Though :)

Too many bad things happened on this date in history unfortunately..

1653 : English Parliament dissolved by Oliver Cromwell
1871 : Opening of Japan's first government-operated post-office
1889 : Birth of Adolf H.
1924 : Dissolution of Ottoman Empire (phew!)
1949 : Birth of Jessica Lange
1999 : Columbine High School Shooting by dem Trenchcoat Mafia
2008 : Danica Patrick - first woman to win IndyCar 300
2010 : Deepwater Horizon oil rig explosion
2020 : Tech-savvy time-saver's 3000th boast

Sunday, April 19, 2020

Learn Thou xargs John McNamara!

What he tells you to do :

$ unzip myfile.xlsm -d myfile
$ xmllint --format `find myfile -name "*.xml" | xargs` | grep "Pr.*codeName
"


(that's cool that you can specify the output dir with -d)

What you're better off doing :

$ find myfile -name '*.xml' | xargs xmllint --format | grep 'Pr.*codeName'

works!

Saturday, April 18, 2020

The Crappiness of Gabriel Weinberg

Homage to his heritage might make for a better SE.

Sums up the difference between Google and Ducko :

DuckDuckGo :

And Google :

Thursday, April 09, 2020

The Real Git Crash Course

From one who's crashed too many times from not knowing Git sufficiently..

> Enter the Dojo
Welcome Han Solo

> Get uniform
Here is your white belt

# tell git to begin operations in this directory
> git init

# start tracking files
> git add /path/to/files.type

# commit these
> git commit -m "initial commit"

Now, these are tracked files.. They can be :
  • modified : you touched a file, but haven't staged if for inclusion in the next check-in
  • staged : you've told Git (using a git add) that the next commit will check-these changes in
  • committed : clean state - like after you commit something that you git added recently..

> Upgrade uniform
Here is your Yellow belt.

This git status thing is taking too long. How can I look at the status of only the files I care about?
> git status -uno

How should you hire someone who says they know git?
Ask them about what makes a good commit message : It should keep the audience in mind - what would help/frustrate a future user of the code? What is her opinion of commit messages like "update", "change", "fix", "check-in"? What's a sign you need to split your patch into sub-patches? How many problems should you fix per patch? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=HEAD

# skip staging and commit all tracked, modified files
> git commit -a -m "message"

# I want more power..
> git log -p    # gives you the diff -u style output

# I want interactivity
> tig <usual git command>    # first time can take a while to finish..

> Upgrade uniform
Here is your green belt!

# I want to unstage a file
> git reset  HEAD files  # or
> git reset -- files

# push an already populated and maintained Git repository to GitHub :
! create a new repo on Github without a readme file
# locally,
> git remote add origin https://github.com/username/reponame # get this off the browser
> git push -u origin master

# stop having to enter username and pw for each Github stroke :
> git config --global credential.helper cache    # good for 15 minutes

# Barca class git usage - aka finess
> git log --since=2017-9-12
> git log --grep=<regex>
# change most recent commit :
> git commit --amend

> Upgrade uniform
Here is your black belt!

Acknowledging my debt to the maestros at GOOG :

CommandExplanation & Link
git commit -aStages files automatically
git log -pProduces patch text
git showShows various objects
git diffIs similar to the Linux `diff` command, and can show the differences in various commits
git diff --stagedAn alias to --cached, this will show all staged files compared to the named commit
git add -pAllows a user to interactively review patches to add to the current commit
git mvSimilar to the Linux `mv` command, this moves a file
git rmSimilar to the Linux `rm` command, this deletes, or removes a file
There are many useful git cheatsheets online as well. Please take some time to research and study a few, such as this one.

.gitignore files

.gitignore files are used to tell the git tool to intentionally ignore some files in a given Git repository. For example, this can be useful for configuration files or metadata files that a user may not want to check into the master branch. Check out more at: https://git-scm.com/docs/gitignore.
A few common examples of file patterns to exclude can be found here.
git reset basically resets the repo, throwing away some changes. It’s somewhat difficult to understand, so reading the examples in the documentation may be a bit more useful.
There are some other useful articles online, which discuss more aggressive approaches to resetting the repo.
git commit --amend is used to make changes to commits after-the-fact, which can be useful for making notes about a given commit.
git revert makes a new commit which effectively rolls back a previous commit. It’s a bit like an undo command.
There are a few ways you can rollback commits in Git.
CommandExplanation & Link
git branchUsed to manage branches
git branch <name>Creates the branch
git branch -d <name>Deletes the branch
git branch -D <name>Forcibly deletes the branch
git checkout <branch>Switches to a branch.
git checkout -b <branch>Creates a new branch and switches to it.
git merge <branch>Merge joins branches together.
git merge --abortIf there are merge conflicts (meaning files are incompatible), --abort can be used to abort the merge action.
git log --graph --onelineThis shows a summarized view of the commit history for a repo.
CommandExplanation & Links
git remote Lists remote repos
git remote -vList remote repos verbously
git remote show <name>Describes a single remote repo
git remote updateFetches the most up-to-date objects
git fetchDownloads specific objects
git branch -rLists remote branches; can be combined with other branch arguments to manage remote branches

Wednesday, April 08, 2020

Add Links to Different Parts of the Same Blog Post

Sorry mate, not time sensitive enough :)

http://blogknowhow.blogspot.com/2010/11/add-internal-links-within-blogger-posts.html#withinposts

Although, to be fair, that is where I got it from..

How?

Where you want to jump to, with the Editor in HTML view (not Compose view), you insert
<a name="whatever></a>

Then, go back to Compose view.

Then, where you want to put the link, select the text, do da CTRL-K and then, put in something and say ok. Then, go back to HTML view and edit this most recent bit.

Change it to look like : <a href="#whatever" >here</a>

If blogger has second guessed you and added a target="_blank", remove it!!

Changing Keyboard Shortcuts with Ubuntu XFCE

Shame on Google and DuckDuckNeverCame - can't get an answer to a simple question like this..

But, I've scoured the web so you don't have to :)
Please, go right here... since I made mistakes getting to the final answer... if you're short on time :)

How do you know what desktop window manager you have? KDE, Gnome or something else? (Pray not CDE!)

> env | grep XDG_CURRENT_DESKTOP

See =XFCE? Then read on :)

You'll see tonnes of pages telling you to go into "Keyboard" (Applications Menu > Settings > Keyboard )

No! Do not!

All you do is :

Applications Menu > Settings > Settings Editor (Yes, a bit of an eye chart to get there ) (Note, not Settings Manager but Editor :)

You should see something like this :


Again, ignore keyboards. Go to xfce4-keyboard-shortcuts . When you click on that, the right pane gets populated with tonnes of stuff. Scroll down and find the one you want. If you're like me, you want something better than ALT-F10 for toggling window maximization :)




Change that to something more finger friendly :)

Yikes! Shame on me - you can't - you can use this dialog to change ALT-F10 to something else..
Means? You have to find the one that already exists for the key combo you want and change that. If you're big on ALT-F1 to be left-hand-finger-friendly :), you'll see it's xfce4-popup-applicationsmenu by default. Change it to maximize_window_key

And :) Welcome back. Didn't work did it? :) Trust me, I feel your pain. Fortunately, this one gave me a decent lead and problem solved :

https://askubuntu.com/questions/90513/how-do-i-change-my-keyboard-shortcuts-in-xubuntu

You do go to Settings Manager and then hit Window Manager :







And then, when you click on a setting of interest and then hit Edit, it'll ask you to hit the key combo you want, and you're all set..