Joined March 2012
·

Richo Healey

Security Engineer at psych0tik.net
·
Melbourne, Victoria
·
·
·

Posted to Mischievous of bang operator in ruby over 1 year ago

He linked to the docs for collect, so I'm assuming that's where he went sideways.

That aside, ! is an operator, but methods with the bang suffix have nothing to do with that.

Posted to 'git pull' is evil! over 1 year ago

Urgh, unless your history has been published.

Blanketly telling people to use one or the other is stupid.

What language does this work in specifically? I'm not aware of any that it's even valid syntax, let along a "bitwise" way to coerce floats.

Bitwise is implicitly not going to work unless you happen to know how your floats are encoded.

You said using git protocol, but that's different (git://)

Posted to Quickly clone a large git repo over 1 year ago

Bear in mind that you can't commit to a shallowly cloned repo.

Posted to Change file directory in ruby over 1 year ago

You do enclose the system() calls in a block to not tamper with the global working directory

Dir.chdir("foo") do
  system('pwd')
  system('ls RailsCasts/')
end

EDIT: Note this is NOT threadsafe.

Posted to push automatically on commit over 1 year ago

It also needs to be executable.

chmod +x .git/hooks/post-commit

Although tbh I'm not sure this is a great idea.

Posted to Spawn processes using Python over 1 year ago

I think you mean s/p1/mavenProcess/

Posted to Using bash? Check zsh out!! over 1 year ago

Why the hating on bash? You don't actually present a single argument against it :/

Posted to Numbered List Ruby One-Liner over 1 year ago

You don't need ruby

function list() { seq $1 | while read n; do echo "${n}. "; done }

Posted to Parse a .rvmrc file using a Regex over 1 year ago

Does the RVM gem export any of this functionality?

If not, it's probably to be considered a bug, I'd happily work on it.

Posted to Map with class' method over 1 year ago

Ah, my bad. Thanks for clearing that up.

Posted to Map with class' method over 1 year ago

Pretty sure the & is superfluous, #method should return a callable :)

Errr ok, that was fairly hostile all things considered.

"Intention makers" and especially this implementation look to me like a massive afterthought. "The actual API wasn't hugely expressive, lets implement a shitton of keywords to clean it up".

Python is moving AWAY from keywords (print) as much as possible, because epic lexer abuse (http://entrian.com/goto/) aside, they are difficult to work around when you need to interact with them (like testing them, amusingly).

My point was mainly that adding more layers of abstraction around what is a totally mutable interface is nearly always a symptom of Doing It Wrong, why not just clean up the original interface and not require the language to implement a ton of keywords to make your test harness work?

Can you explain how this is pythonic?

The BDFL was pretty clear, explicit is better than implicit. This seems like a lot of magic to me.

Posted to Functional Python over 1 year ago

What do you mean "One time use" in the context of lambdas? They're first class objects.

You need to mark the pre-commit hook as executable if you want git to invoke it.

chmod +x pre-commit

Not really. I think you're trying to explain something you don't really understand. Which is fine.. but you probably shouldn't be teaching your interpretation as fact.

When you invoke each you're defining a block, which is a binding complete with it's own local scope and then passing that into the each method, which calls your block once for each value in the set.

`
block = Proc.new do |v|
puts v
end

[1, 2, 3].each(&block)
[4, 5, 6].each(&block)
`

The block is an entirely seperate entity.The for loop is a language construct.

I don't get it. Have you updated it? This is still blatantly wrong.

Yeah, you read it wrong.

For doesn't create any local scope. Example here: https://gist.github.com/4109520

Posted to Remove passphrase from private key over 1 year ago

Advocating poor security is a terrible practice.

No, it isn't.

foo.each do |blah|
...
end

creates a new lexical scope for the block,

for i in foo
...
end

Does not. If you don't know what you're talking about, please don't preach. You're misleading people.

Putting the onus on devs to write good docs on top of good code for anything that isn't a library with existing traction is stupid because it will never happen.

Until a library has 10x more people using it than writing it, putting work into docs is pretty much time you're putting down the sink, and even then there are largish, well used codebases for which it makes no sense (https://github.com/benhoskings/babushka is a great example).

I tell people to RTFS all the time. I generally link them to the code in question, and specifically often tell them to read the history or look at a specific set of commits. Equating that to a vitriolic fuck you is naieve and honestly, in my opinion a sign of laziness.

Your beginner argument falls on it's ass because noone ever moved on from being a beginner by being spoonfed. I'm not expecting to change your opinion- but I am hoping to at least get you to inspect yours a little more closely.

How is this a fuck you? Well written code is self documenting.

You're telling people to download and subseqeuntly trust a CA cert they're fetching over http from a host they're not verifying, and without verifying the cert itself.

Please remove this tip, or amend it to not do anything that's a travesty to infosec.

Oh, sorry maybe I didn't explain well enough.

It's also worth noting that if you do something like:

git co -b wip/foo
# hack hack hack
git push -u origin wip/foo
# Oh, shit I'm going to make a few passes at this
git push origin :wip/foo
git branch -M wip/foo/stuff
git push -u origin wip/foo/stuff

Everything will look sane to you, but it'll explode on anyone who fetched the old ref and they'll need to git remote prune. Basically, unless you're in a position to go around to everyone, it's more antisocial than rebasing public commits.

Hope this helps.

Posted to Local non-compiling git save-points over 1 year ago

Just push a wip/ tree, (ie, wip/features/some_new_feature) This way you have a backup and some exposure to what you're working on, but noone in their right mind would base work ona wip/ branch.

Posted to Undo git reset over 1 year ago

Assuming reflogging is turned on.

You should elaborate on how this works, ie, ref@{n} is a symbolic ref for n entries ago in ref's reflog.

Recent versions of git also support @{2.days.ago} etc.

Posted to Keep your feature branch up to date. over 1 year ago

Also, / is totally valid in a refname, so if you've named your branch bugs/661-descriptionofbug it'll explode.

Posted to Keep your feature branch up to date. over 1 year ago

Even better, just git fetch && git merge origin/master (subbing origin for whatever you named the remote you're interested in).. or for master git-fu master@{u} will use master's upstream tracking branch on versions of git later than somewhere around 1.7 (I forget where this syntax was introduced)

Posted to Git: choose your ssh key over 1 year ago

Or just use ssh-agent(1) and avoid all this juggling?

Posted to Colorize git over 1 year ago

You should set this to auto if you don't want broken git output when not attached to a smart terminal.

Why jump through hoops with reassignment instead of if klass.is_a?(Class)

Posted to From RVM to rbenv over 1 year ago

It only overloads cd if you're using bash, since most developers use zsh now it's a bit of a non-argument.

Achievements
243 Karma
9,098 Total ProTip Views