Udun's Labs

Tensorflow Links

Bookmarks overflow

Sort Before You Loop

Why is it faster to process a sorted array than an unsorted array?

And a python quirk:

Prints:

C:\_\Python27\python.exe C:/Users/MrD/.PyCharm2016.2/config/scratches/timeit_key_tuple_sorting.py
***** STRINGS
0.683437665535
0.659069905351
0.578510675866
***** INTS
0.116263496833
0.200527380123
0.160531444582
***** OBJECTS
9.64448849458
7.22313209823
6.99353018193
***** BONUS range vs xrange and inlining length
3.16139231018
3.13278352095
2.18729023897
2.16974310625

For an explanation see Why is sorting a python list of tuples faster when I explicitly provide the key as the first element?. Note that for int keys the non key way is still faster - apparently the overhead of lambda (or even itemgetter) compared to int comparison is significant.

Pacman Pycharm

Uninstall:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# find / -path /mnt/win -prune -o -iname "*Pycharm*"
/usr/bin/pycharm
/usr/share/applications/pycharm-community.desktop
/usr/share/pixmaps/pycharm.png
/opt/pycharm-community
/opt/pycharm-community/bin/pycharm.sh
/opt/pycharm-community/bin/pycharm.png
/opt/pycharm-community/bin/pycharm.vmoptions
/opt/pycharm-community/bin/pycharm64.vmoptions
/opt/pycharm-community/help/pycharmhelp.jar
/opt/pycharm-community/lib/pycharm.jar
/opt/pycharm-community/lib/src/pycharm-openapi-src.zip
/opt/pycharm-community/lib/src/pycharm-pydev-src.zip
/opt/pycharm-community/lib/pycharm-pydev.jar
/opt/pycharm-community/helpers/pycharm
/opt/pycharm-community/helpers/pycharm/pycharm_commands
/opt/pycharm-community/helpers/pycharm/pycharm_commands/pycharm_test.py
/opt/pycharm-community/helpers/pycharm/pycharm_run_utils.py
/opt/pycharm-community/helpers/pycharm/pycharm_setup_runner.py
/opt/pycharm-community/helpers/pycharm_generator_utils
/home/utumno/.PyCharm30
/home/utumno/.local/share/applications/jetbrains-pycharm.desktop
/home/utumno/.gnome/apps/jetbrains-pycharm.desktop
/var/lib/pacman/local/pycharm-community-3.1.1-1
/mnt/win

# pacman -R pycharm-community
checking dependencies...

Packages (1) pycharm-community-3.1.1-1

Total Removed Size:  192.85 MiB

:: Do you want to remove these packages? [Y/n] y
(1/1) removing pycharm-community

# find / -path /mnt/win -prune -o -iname "*Pycharm*"
/home/utumno/.PyCharm30
/home/utumno/.local/share/applications/jetbrains-pycharm.desktop
/home/utumno/.gnome/apps/jetbrains-pycharm.desktop
/mnt/win

Java:

1
2
# echo $JAVA_HOME
/opt/java

Using AUR:

Set Up Octopress in Arch Linux

Disclaimer: Hack and slash

Well I started using an ancient arch install I had - and I needed to use my blog. Given I know nothing of ruby and octopress had left me with open questions I doubted I’d succed. Well I did - here is how:

[root@mrsd-arch utumno]# pacman -S ruby
Packages (2) libyaml-0.1.6-1  ruby-2.2.3-1
##: hmmm - warning below I missed, see below
The default location of gem installs is $HOME/.gem/ruby
Add the following line to your PATH if you plan to install using gem
$(ruby -rubygems -e "puts Gem.user_dir")/bin
##: ....

Then:

[root@mrsd-arch utumno]# gem install bundler
Fetching: bundler-1.10.6.gem (100%)
##: hmmm - warning below I missed, see below
WARNING:  You don't have /root/.gem/ruby/2.2.0/bin in your PATH,
      gem executables will not run.
Successfully installed bundler-1.10.6
##: ....
[root@mrsd-arch utumno]# exit

I did not want to install octopress - just keep using my existing blog:

utumno@mrsd-arch ~ $ cd /mnt/win/Dropbox/Udun/octopress/
utumno@mrsd-arch /mnt/win/Dropbox/Udun/octopress (source) $ rake preview
rake aborted!
LoadError: cannot load such file -- bundler/setup
/mnt/win/Dropbox/Udun/octopress/Rakefile:2:in `<top (required)>'
(See full trace by running task with --trace)

Remember the warnings ? Issue:

PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH"

Then - below from a fresh install:

utumno@mrsd-arch /mnt/win/Dropbox/Udun/arch_octopress/octopress (master) $ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.4.2
##: ....
Password:

SystemExit: exit
An error occurred while installing RedCloth (4.2.9), and Bundler cannot
continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.

Ooops - back to my own blog:

Creating an Eclipse Plugin

First download the Eclipse IDE for Eclipse Committers - used to be called Eclipse Standard - see this bug for chit chat.

Run it, New Project > Plug-in Project. Apart from trivial choices why does it not have eclipse version bigger than 3.5 ?

images

Question already asked and answered: Eclipse RCP Plug-in Target Platform.

Next the plugin content - official docs - in particular “Adding API Analysis to the project will enable static analysis of API usage from the new project”.

Next you get at the project templates - I had some difficulty finding them. Choose and template and then - git (TBC)

Links for later:

Testing:

Tutorials - there are a gazillion out of date tutorials but for e4 see:

And messing with eclipse code (I will be blogging on this separately soon):

Bonus: Install Eclipse Plugins - The Easy Way

And some fun: How to become an Eclipse committer in 20 minutes and fork the IDE

Git Untrack

A brief on ignoring files. I wish it was as simple as that.

The biggest problem for me is when I want to ignore a file that was previously tracked - ignore it forever but have it not deleted when someone pulls from the remote. This is not possible unfortunately - see the comments by torek starting here.

And a git assume-unchanged vs skip-worktree post that details what happens to an --assume-unchanged file on pull etc. Also SO questions:

If you want to --skip-worktree a directory cd to the directory and issue git ls-files -z | xargs -0 git update-index --assume-unchanged - see there for a find alternative.

To see the files that are skipped: git ls-files -v.

Glob patterns to regexes:

And btw adding .“gitignore” to .gitignore works perfectly.

And git filter branch a file out: git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD

Bonus: - squash last 3 commits: git reset –soft head~3 && git add -A && git commit -m “Squashed 3 last commits” - git rebase –onto - should be using it more - .gitignore Syntax: bin vs. bin/* vs. bin/** vs bin/

Pycharm Scratch Head Moments

Well hitting Ctrl+G (eclipse profile) to “Find Usages in Project” I got “Non-code usages” - how very annoying. Settings search box > find - only found the keymaps page. Finally from Finding Usages in Project I got the Ctrl+Shift+Alt+F7 shortcut - untick “Search for text occurrences”

Resetting read only status - what a huge pain

Sharing settings

Interpreter