Skip to content

Instantly share code, notes, and snippets.

View andreaferretti's full-sized avatar

Andrea Ferretti andreaferretti

  • Bending Spoons
  • Milano
View GitHub Profile
@andreaferretti
andreaferretti / keybase.md
Created September 10, 2019 08:34
keybase.md

Keybase proof

I hereby claim:

  • I am andreaferretti on github.
  • I am andreaferretti (https://keybase.io/andreaferretti) on keybase.
  • I have a public key ASB1C3n5xhQt2Ul4cj3e24uRhKRnxDwiMd8yQJ6YbFnojgo

To claim this, I am signing this object:

@andreaferretti
andreaferretti / nim_magic.py
Created June 14, 2018 14:36 — forked from apahl/nim_magic.py
Nim cell magic for Jupyter and JLab Notebooks
"""
nim_magic.py
Jupyter cell magic for your favorite programming language.
Requirements: Nim (https://nim-lang.org), nimpy (`nimble install nimpy`, thanks to @yglukhov for this great library!)
Just put this file in some Python import dir
and then, in a Jupyter or JLab Notebook:
@andreaferretti
andreaferretti / README.md
Last active November 4, 2019 21:38
mynim - manage nim versions

MyNim

MyNim is a tool to install and manage various versions of Nim and related tools.

Since it requires a bash and symlinks, it works fine on Unix derived systems (e.g. MacOSX or Linux) but not on Windows.

Installing MyNim

Just download the mynim file, make it executable and put it somewhere on your $PATH.

@andreaferretti
andreaferretti / ex.nim
Created February 10, 2017 17:36
Nimble fix
var exitCode = 0
if showOutput:
exitCode = execCmd(cmd)
else:
let (output, ec) = execCmdEx(cmd)
exitCode = ec
displayDebug("Finished", "with exit code " & $exitCode)
displayDebug("Output", output)
@andreaferretti
andreaferretti / libimobiledevice_ifuse_Ubuntu.md
Created January 25, 2017 22:05 — forked from samrocketman/libimobiledevice_ifuse_Ubuntu.md
On Ubuntu 16.04, since iOS 10 update, libimobiledevice can't connect to my iPhone. This is my attempt to document a fix.

Why this document?

I upgraded my iPhone 5s to iOS 10 and could no longer retrieve photos from it. This was unacceptable for me so I worked at achieving retrieving my photos. This document is my story (on Ubuntu 16.04).

The solution is to compile libimobiledevice and ifuse from source.

Setup environment

Don't forget to set up your environment before building. I typically build and install packages to my local user at $HOME/usr.

@andreaferretti
andreaferretti / heap.nim
Last active July 13, 2016 09:37
Auto ref types
template `~`(x): auto =
var h: ref type(x)
new(h)
h[] = x
h
type Foo = object
a, b, c: ref int
d: ref seq[int]
@andreaferretti
andreaferretti / expand.nim
Created July 12, 2016 15:23
Nim macro expansion
import macros
macro expandMacros(body: stmt): stmt =
template inner(x: stmt): stmt = x
result = getAst(inner(body))
echo result.toStrLit
/**
* The Matrix Example
* http://wiki.neo4j.org/content/The_Matrix
*/
case class Matrix(name: String, profession: String)
object TheMatrix extends App with Neo4jWrapper with EmbeddedGraphDatabaseServiceProvider {
ShutdownHookThread {
shutdown(ds)