Skip to content

Instantly share code, notes, and snippets.

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-=============================================================-=========================================-=======================================================
ii ack-grep 1.80-1 A grep-like program specifically for large source trees
ii acl 2.2.47-2 Access control list utilities
ii acpi-support 0.121 scripts for handling many ACPI events
ii acpid 1.0.6-9ubuntu4.9.04.3
class Context
end
Context.new.instance_eval <<-END
class String
def foo() 'foo' end
end
puts ''.foo
END
Java Logging is Awesome
=======================
### Since I am incapable of determining information about my own runtime environment, please provide it to me. Also, this is from a *library* and there's no obvious way to turn it off, rendering DEBUG logging statements from my own application all but useless.
DEB [20100119-17:50:05.225] httpclient: Java version: 1.6.0_15
DEB [20100119-17:50:05.225] httpclient: Java vendor: Apple Inc.
DEB [20100119-17:50:05.226] httpclient: Java class path: /Users/james/bin/sbt-launcher.jar
DEB [20100119-17:50:05.226] httpclient: Operating system name: Mac OS X
DEB [20100119-17:50:05.226] httpclient: Operating system architecture: x86_64
~/dev/tmp| irb
>> a = File.open('foo')
=> #<File:foo>
>> File.open('foo', 'w') {|f| f << 'foo' }
=> #<File:foo (closed)>
>> a.rewind; a.read
=> "foo"
>> File.open('foo', 'w') {|f| f << 'bar' }
=> #<File:foo (closed)>
>> a.rewind; a.read
function createNamedFunction() {
var _cnf = Array.prototype.slice.call(arguments, 0);
_cnf.name = _cnf.shift();
_cnf.code = _cnf.pop();
return new Function('return function NAME(ARGS) {CODE}'.
replace('NAME', _cnf.name).
replace('ARGS', _cnf.join(',')).
replace('CODE', _cnf.code))();
}
class Foo
@bar: -> 'bar'
# baz: -> Foo.bar()
baz: -> @constructor.bar()
class Boo extends Foo
@bar: -> 'moo'
@mynyml
mynyml / comprehension_scope.coffee
Created January 22, 2011 21:06
execution scope of _ref in array comprehensions is non-intuitive
bar = ->
foo()
foo = ->
v for k,v of arguments.callee.caller.arguments
console.log bar('x','y') #=> ['x','y']
foo = ->
args = (v for k,v of arguments.callee.caller.arguments)
@mynyml
mynyml / stdoutAndThrow.coffee
Created February 12, 2011 19:50
Thrown Error not raised unless data gets printed to stdout beforehand
# NOTE:
# uncommenting either of the two `console.log ''` lines bellow will "fix" the problem, and the error message will be printed to stdout.
# Also interesting: if the line `console.log 'in finally'` is replaced with `util.debug 'in finally'`, the problem comes back (i.e. even with the log lines uncommented)
require('path').exists '/tmp/alskdjf', (exists) ->
try
# console.log ''
throw new Error
finally
console.log 'in finally'
### Keybase proof
I hereby claim:
* I am mynyml on github.
* I am maumont (https://keybase.io/maumont) on keybase.
* I have a public key ASAFSRRffQrdhjhVEKGrKI5UFXXdQ_UMFpSZcyV2xsinYgo
To claim this, I am signing this object:
@mynyml
mynyml / 1_kubernetes_on_macOS.md
Created August 20, 2018 19:59 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites