Skip to content

Instantly share code, notes, and snippets.

View Drunkar's full-sized avatar

Akio Ohta Drunkar

View GitHub Profile
@quadrismegistus
quadrismegistus / gensim_word2vec_procrustes_align.py
Last active November 16, 2023 01:57
Code for aligning two gensim word2vec models using Procrustes matrix alignment. Code ported from HistWords <https://github.com/williamleif/histwords> by William Hamilton <wleif@stanford.edu>. [NOTE: This code is DEPRECATED for latest versions of gensim. Please see instead this updated version of the code <https://gist.github.com/zhicongchen/9e23…
def smart_procrustes_align_gensim(base_embed, other_embed, words=None):
"""Procrustes align two gensim word2vec models (to allow for comparison between same word across models).
Code ported from HistWords <https://github.com/williamleif/histwords> by William Hamilton <wleif@stanford.edu>.
(With help from William. Thank you!)
First, intersect the vocabularies (see `intersection_align_gensim` documentation).
Then do the alignment on the other_embed model.
Replace the other_embed model's syn0 and syn0norm numpy matrices with the aligned version.
Return other_embed.
#!/usr/bin/env python
import rospy
import mavros
from geometry_msgs.msg import PoseStamped
from mavros.msg import State
from mavros.srv import CommandBool, SetMode
# callback method for state sub
current_state = State()
@mcoms
mcoms / README.md
Created May 17, 2016 21:50
Eken H9 Action Camera Firmware

Official source for the latest firmware

Eken supply firmware for their H2, H2R, H3, H3R, H8, H8R, H9 and H9R cameras via the following site:

http://ftp.eken.com/

The "R" camera versions come with a remote control.

Selecting the right file

@daveliepmann
daveliepmann / irises.md
Last active July 21, 2023 12:08
Implementing Sugar & James’ paper, "Finding the number of clusters in a data set: An information theoretic approach" in Clojure — Part 1

Implementing the k-means jump method: Part One

This paper:

Finding the number of clusters in a data set: An information theoretic approach

CATHERINE A. SUGAR AND GARETH M. JAMES

>Marshall School of Business, University of Southern California

@sandcastle
sandcastle / GeoData.cs
Created May 4, 2016 14:30
A Unity 3D behaviour for Geo location lookup via IP address
using UnityEngine;
using System.Collections;
using Newtonsoft.Json;
/// <summary>
/// The Geo data for a user.
///
/// http://ip-api.com/docs/api:json
///
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Networking.NetworkSystem;
using System.Collections;
public class Connector : MonoBehaviour {
int connectionAttemptCount;
NetworkClient client;
bool errorHappened;
void Start () {
StartClient ();
@nosuz
nosuz / bom2excel.rb
Last active February 6, 2017 09:10
#!/usr/bin/ruby
#require 'csv'
require 'axlsx'
require 'rexml/document'
Component = Struct.new(:item, :ref, :value, :footprint)
Order = Struct.new(:item, :value, :footprint, :count)
xml_file = File.expand_path(ARGV[0])
@erikbern
erikbern / install-tensorflow.sh
Last active June 26, 2023 00:40
Installing TensorFlow on EC2
# Note – this is not a bash script (some of the steps require reboot)
# I named it .sh just so Github does correct syntax highlighting.
#
# This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5
#
# The CUDA part is mostly based on this excellent blog post:
# http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/
# Install various packages
sudo apt-get update
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andete
andete / gist:71b531b081fbc3ac0671
Created May 25, 2015 09:02
KiCad BOM script example
#!/usr/bin/env python
# (c) 2015 Productize <joost@productize.be>
import sys, copy, collections, codecs
from bs4 import BeautifulSoup
soup = BeautifulSoup(open(sys.argv[1]))
date = soup.design.date.contents[0]