Skip to content

Instantly share code, notes, and snippets.

View riffraff's full-sized avatar

Gabriele Renzi riffraff

View GitHub Profile
@riffraff
riffraff / gist:2fdf81e78255cae719bc8cb0fe6d92bf
Created February 20, 2022 06:11
Equal Rites - the bit with Granny and Eskarina staring at each other in a conflict of wills
Esk gazed down defiantly. Granny glared up sternly. Their wills clanged like cymbals and the air between them thickened.
But Granny had spent a lifetime bending recalcitrant creatures to her bidding and, while Esk was a surprisingly strong
opponent, it was obvious that she would give in before the end of the paragraph.
from importlib.machinery import ModuleSpec
from .source import make_source
# For some reasons I need to be able to have dynamically generated modules so I can do
#
# from borsa_italiana.isin.<dynamic value> import Source
#
MAGIC_MODULE_NAME = 'borsa_italiana.isin'
MODULE_PATH = [] # dummy, but we need to set it to something, but why?

Keybase proof

I hereby claim:

  • I am riffraff on github.
  • I am riffraff (https://keybase.io/riffraff) on keybase.
  • I have a public key whose fingerprint is 20DC 1E25 497A 99D8 7D6F 6A2B E134 B543 8C61 DAC8

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am riffraff on github.
  • I am riffraff (https://keybase.io/riffraff) on keybase.
  • I have a public key whose fingerprint is CDF5 BD15 3CBC F3D3 F7DF B669 5951 B1E4 CB1A EA67

To claim this, I am signing this object:

Multiple markers at this line
- exception during macro expansion: java.lang.NullPointerException at
scala.tools.nsc.interactive.ContextTrees$class.addContext(ContextTrees.scala:78) at
scala.tools.nsc.interactive.Global.addContext(Global.scala:28) at
scala.tools.nsc.interactive.Global.registerContext(Global.scala:268) at scala.tools.nsc.typechecker.Contexts
$Context.make(Contexts.scala:295) at scala.tools.nsc.typechecker.Contexts$Context.make0(Contexts.scala:
320) at scala.tools.nsc.typechecker.Contexts$Context.make(Contexts.scala:327) at
scala.tools.nsc.typechecker.Typers$Typer.atOwner(Typers.scala:5662) at
scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:33) at
scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:28) at
@riffraff
riffraff / gist:7500698
Created November 16, 2013 14:21
freezes online elm repl
iterate n f x =
if n == 0 then x
else iterate(n - 1 f f(x))
square x = x * x
main = asText (iterate 4 square 0)
def stuff
magic!
puts "ciao"
end
def magic
at_caller_method_exit { puts "magic!" }
end
mecbucpro:tmp postgres$ /Library/PostgreSQL/9.2/bin/pg_upgrade --old-port 5432 --new-port 5433 --old-datadir /Library/PostgreSQL/9.1/data/ --new-datadir /Library/PostgreSQL/9.2/data/ --old-bindir /Library/PostgreSQL/9.1/bin/ --new-bindir /Library/PostgreSQL/9.2/bin/ --verbose --link --retain --check --user=postgres
Running in verbose mode
Performing Consistency Checks
-----------------------------
Checking current, bin, and data directories ok
Checking cluster versions ok
pg_control values:
First log file ID after reset: 28
First log file segment after reset: 215
# possible now
def retrying times=x # or strategy
attempt = 0
yield
rescue
attempt+=1
retry if attempt < times # or retry if strategy
end
retrying(1) { open_url }
@riffraff
riffraff / gist:2882358
Created June 6, 2012 14:53
linkedin dump password check
# assumes you have the dump in the same dir as combo_not.txt
require 'digest/sha1'
puts "insert password"
system "stty -echo"
pass = gets.chomp
system "stty echo"
hex= Digest::SHA1.hexdigest(pass)
puts hex
system "grep #{hex} combo_not.txt"
hex.sub!(/^...../,'00000')