Skip to content

Instantly share code, notes, and snippets.

Avatar
🏔️

ixaxaar ixaxaar

🏔️
View GitHub Profile
View gdb-logs
gdb python
GNU gdb (GDB) 8.0.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
View pytorch-faiss-interop.py
import faiss
from faiss import cast_integer_to_float_ptr as cast_float
from faiss import cast_integer_to_int_ptr as cast_int
from faiss import cast_integer_to_long_ptr as cast_long
import torch as T
def ptr(tensor):
View repacakage_hidden.py
def repackage_hidden(h):
"""Wraps hidden states in new Variables, to detach them from their history."""
if type(h) == Variable:
return Variable(h.data)
elif type(h) == tuple:
return tuple(repackage_hidden(v) for v in h)
elif type(h) == list:
return [ repackage_hidden(v) for v in h ]
def repackage_hidden_dnc(h):
View numberbatch.md
  1. download model
if [[ ! -e 'numberbatch-17.06.txt' ]]; then
    wget https://conceptnet.s3.amazonaws.com/downloads/2017/numberbatch/numberbatch-17.06.txt.gz
    gunzip numberbatch-17.06.txt.gz
fi
sudo pip install wordfreq
sudo pip install gensim
View langid
#!/usr/bin/env bash
sudo apt-get install -y python3-pip python3-dev python-dev python-pip
sudo pip install langid
sudo pip2 install langid
sudo pip3 install langid
@ixaxaar
ixaxaar / beamPermute.scala
Last active Mar 2, 2017
Beam over permutations, find the best possible sequence given a perplexity function
View beamPermute.scala
def beamPermute[T](
data: List[T],
perplexityFn: List[T] => Double,
startNode: T,
beamSize: Int = 10,
beamWindow: Int = 3
): List[(List[T], Double)] = {
var candidates = List((List(startNode), 0d))
View beam.scala
def beam[T](
data:List[List[T]],
perplexityFn: List[T] => Double,
startNode:T,
beamSize:Int = 10)
:List[(List[T], Double)] = {
var candidates = List((List(startNode), 0d))
data.foreach{ case datum:List[T] =>
@ixaxaar
ixaxaar / install_cassandra.sh
Created Sep 2, 2016
Multi-DC cassandra installer
View install_cassandra.sh
#!/usr/bin/env bash
# A script to install cassandra
# Deploy a few instances as seed nodes first, this script can run on those seed nodes as well
# Number of seed nodes equal number of data centers
# Add the seed nodes here
SEEDS[0]='172.31.40.98'
SEEDS[1]='172.31.40.99'
SEEDS[2]='172.31.40.100'
View tinkerpop.md

Traversals

Traversal[S,E] which implements Iterator[E] where S:Start, E:End

Step[S,E] //  an individual function applied to S to yield E . Steps are chained within a traversal.
TraversalStrategy // interceptor methods to alter the execution of the traversal (e.g. query re­writing).
TraversalSideEffects // key/value pairs that can be used to store global information about the traversal.
Traverser[T] // the object propagating through the Traversal currently representing an object of type T .
View curl.log
curl -v https://dl.bintray.com/sbt/sbt-plugin-releases/org.apache.commons/commons-parent/32/jars/commons-parent.jar
* Trying 108.168.243.150...
* Connected to dl.bintray.com (108.168.243.150) port 443 (#0)
* found 173 certificates in /etc/ssl/certs/ca-certificates.crt
* found 704 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* gnutls_handshake() failed: Error in the pull function.
* Closing connection 0
curl: (35) gnutls_handshake() failed: Error in the pull function.