Joined March 2013
·

Rafał Malinowski

Red Sky
·
Szczecin, Poland
·
·
·

Posted to Upgrade bash on your mac os ! over 1 year ago

@peggyli
/bin/sh and /bin/bash are still system defaults and brew will not overwrite the system defaults (and I totally agree with their approach).
If you will run which bash you should get something like /usr/local/bin/bash and this is bash installed with brew.

MacOS is using system bash version also for /bin/sh but in other unix systems you'll get different shell (for example debian is using dash as default nowadays) so you shouldn't assume that /bin/sh and /bin/bash are the same. You can have multiple shells like zsh, dash, fish, bash ;)

To run scripts with newest bash version you'll have to run in manually with bash myscript.sh. You can also set #!/usr/local/bin/bash in the top of your script and then run it without a sh/bash command like . myscript.sh

Also if you don't know it may be a good time to move to zsh as this will be the default shell in 10.15.

Cheers !

Posted to Eureka! I finally understand closures over 1 year ago

Closure in JS can give you one (of many) awesome thing -> "private" functions/variables. Look at the scope of this in that example. If you don't return add function you can use only inside makeAddFunction.
Also look at this book and especially into module and revealing module pattern:
http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/#revealingmodulepatternjavascript

And don't use *.pyc without any type of quotes or find will throw error like:
unknown primary or operator or paths must precede expression (depends on system I think).

With quotes everything is ok: find . -name "*.pyc" -delete

It's quite easye to implement to be honest. 50-60 lines of code and it's done.

I'm not using OCR function. The OCR button on my scanner is merging already scanned files (to tiff) to one pdf.

If you want to scan multiple pages to one PDF you have 2 options with my scripts:
1. Scan every single page to image.
2. Run "scan to ocr" to merge those tiffs to one PDF.

You can also scan all pages except the last one with "scan to image" and the last one scan with "scan to file". This will scan the last page to image and then merge those images to one PDF.

I'm not using OCR because I'm scanning stuff like bills and then I'm putting them into evernote.

Posted to Installing Rails on OSX over 1 year ago

Well I'm not a ruby dev but I'm using rbenv and ruby-build installed with brew.
After that it's just rbenv install 1.9.3-p327.

Posted to cp with progress bar over 1 year ago

You're right for me yours workflow in my opinion is crazy. Especially that "so i need to force some scripts to use my dotfiles" thing :)

We are also using env but it has to be generic as hell to work everywhere cause we are using those scripts to initialize stuff for devs (vagrant though makes life easier with windows users) and for production/staging or even for jenkins.

Posted to cp with progress bar over 1 year ago

To be exact I respect all opinions and I'm not being disrespectful to anyone !

So I'm going to add this 'disclaimer'. If you know what you're doing and you have more aliases (like I have 91 of them; to servers but not only) and you'll remember you might like it.
If you're afraid that you'll brake something don't use it.

And as I said alias is not overwriting/replacing any cp command used in script. That's because running bash script it's not reading .bashrc and all those files which are read only in interactive mode.
There is great article about it: http://blog.flowblok.id.au/2013-02/shell-startup-scripts.html
Also I'm kinda terminal/bash geek and I love to tinker around ;)

There can be a problem when someone will try to do something on your machine.
The clue here is the understanding what is doing what and when. I'm using it and I'm happy. And for the past year or two I had no problems with that. I'm not arguing that this is the best option for everybody. It's just a tip. Do what you like/want.

To be exact I've tested it.
cp -r -6 tests tests2 with my alias should produce something like this:
```
→ cp -6 tests/ tests2
skipping directory tests/.

sent 21 bytes received 20 bytes 82.00 bytes/sec
total size is 0 speedup is 0.00
```

But used in test.sh it's failing with:
cp: illegal option -- 6 usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory

There is also usefull pip freeze to get current packages installed. Especially useful with virtualenv.

Ok. So am I the only one using command + arrows to navigate as home/end ?

Posted to NewLines on PHPUnit tests over 1 year ago

And this is the reason you shouldn't use the php close tag.

Posted to cp with progress bar over 1 year ago

Oh common. I'm making the change and I know that I need to use -r to copy.
If you don't know what you're doing just don't do it. I'm using rsync instead of cp and I don't have problems.

Posted to cp with progress bar over 1 year ago

Guys. Alias is not replacing anything. If you're using cp command in bash scripts it will still use /bin/cp.

Posted to Flush DNS cache on OS X (> 10.6) over 1 year ago

dscacheutil -flushcache is not enough ?

Achievements
332 Karma
33,228 Total ProTip Views