Skip to content

Instantly share code, notes, and snippets.

View giwa's full-sized avatar

Ken Takagiwa giwa

  • Nombre Premier
  • Tokyo
View GitHub Profile
@rutsky
rutsky / docker_gcc-4.9.md
Created May 8, 2014 21:19
GCC 4.9 installation in Docker container
$ sudo docker pull ubuntu
$ sudo docker  run -t -i ubuntu:14.04 /bin/bash
root@856b6aa801af:/# apt-get update
Ign http://archive.ubuntu.com trusty InRelease
Ign http://archive.ubuntu.com trusty-updates InRelease
Ign http://archive.ubuntu.com trusty-security InRelease
Get:1 http://archive.ubuntu.com trusty Release.gpg [933 B]
Get:2 http://archive.ubuntu.com trusty-updates Release.gpg [933 B]
Get:3 http://archive.ubuntu.com trusty-security Release.gpg [933 B]
@bihe
bihe / init.d play
Created September 25, 2011 18:16
init.d script to launch Play framework under Ubuntu
#!/bin/sh
### BEGIN INIT INFO
## END INIT INFO
# Path to play install folder
PLAY_HOME=/usr/share/play
PLAY=$PLAY_HOME/play
# Path to the JVM
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
@jonathan-beebe
jonathan-beebe / AppDelegate.swift
Last active November 1, 2023 19:11
Detect if a Swift iOS app delegate is running unit tests
import UIKit
// Detect if the app is running unit tests.
// Note this only detects unit tests, not UI tests.
func isRunningUnitTests() -> Bool {
let env = NSProcessInfo.processInfo().environment
if let injectBundle = env["XCInjectBundle"] {
return NSString(string: injectBundle).pathExtension == "xctest"
}
return false
@mblondel
mblondel / lda_gibbs.py
Last active October 9, 2023 11:31
Latent Dirichlet Allocation with Gibbs sampler
"""
(C) Mathieu Blondel - 2010
License: BSD 3 clause
Implementation of the collapsed Gibbs sampler for
Latent Dirichlet Allocation, as described in
Finding scientifc topics (Griffiths and Steyvers)
"""
@chezou
chezou / re2testbasic.cpp
Created November 26, 2011 12:05
Sample code of re2 basic regexp functions.
#include <iostream>
#include <string>
#include <re2/re2.h>
#include <vector>
using namespace std;
void test_fullmatch(){
string s,t;
string str("あぶらかたぶら");
@kishida
kishida / App.java
Created August 17, 2012 16:00
かわいいデータベース
package kis.basicdb;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@alecxe
alecxe / runner.py
Last active August 23, 2023 14:19
Self-contained minimum example script to run scrapy
import json
from scrapy.crawler import Crawler
from scrapy.contrib.loader import ItemLoader
from scrapy.contrib.loader.processor import Join, MapCompose, TakeFirst
from scrapy import log, signals, Spider, Item, Field
from scrapy.settings import Settings
from twisted.internet import reactor
@tranminhan
tranminhan / ExcelReading.java
Created May 25, 2011 15:43 — forked from Munawwar/ExcelReading.java
Java - Apache POI - Convert XLS/XLSX to CSV
/*
* Dependencies: Apache POI Library from http://poi.apache.org/
*/
package poi_excels;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
@ybenjo
ybenjo / biterm_topic_model.rb
Last active June 3, 2023 03:16
biterm topic model(www2013)
# Xiaohui Yan, A biterm topic model for short texts(WWW 2013)
require 'set'
class Biterm
def initialize(alpha, beta, k)
@alpha = alpha
@beta = beta
@k = k
@doc_w = { }
@bf4
bf4 / Gemfile
Created July 2, 2013 18:36
Rails lograge and logstash request logging
gem 'lograge' # more readable logs
gem 'logstash-event' # for logstash json format
gem 'mono_logger' # threadsafe logging