Skip to content

Instantly share code, notes, and snippets.

jtoy

View GitHub Profile
@jtoy
jtoy / gist:2fee28d8931de0ce6b5883e4b5658560
Created Mar 3, 2018
Coach tensorflow cpu - Dockerfile
View gist:2fee28d8931de0ce6b5883e4b5658560
FROM ubuntu:16.04
RUN apt-get update -y && apt-get install -y --no-install-recommends \
python3-pip python3-dev cmake zlib1g-dev python3-tk python-opencv build-essential
RUN pip3 install --upgrade pip
RUN pip3 install virtualenv
RUN pip3 install setuptools
RUN mkdir -p /coach
@jtoy
jtoy / perlin.py
Created Dec 26, 2017 — forked from eevee/perlin.py
Perlin noise in Python
View perlin.py
"""Perlin noise implementation."""
# Licensed under ISC
from itertools import product
import math
import random
def smoothstep(t):
"""Smooth curve with a zero derivative at 0 and 1, making it useful for
interpolating.
View etst
setestsetset
est
se
t
est
se
View git hub repo info
Status: 200 OK
Link: <https://api.github.com/repositories?since=364>; rel="next"
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
{
"id": 1296269,
"owner": {
"login": "octocat",
"id": 1,
View naive-bayes.clj
;; 訓練データ
(def text_classified_p '(["good" "bad" "good" "good"]
["exciting" "exciting"]
["good" "good" "exciting" "boring"]))
(def text_classified_n '(["bad" "boring" "boring" "boring"]
["bad" "good" "bad"]
["bad" "bad" "boring" "exciting"]))
;;多変数ベルヌーイモデル
(defn train [features]
@jtoy
jtoy / kill_hadoop_orphans.sh
Created Apr 28, 2012 — forked from dvryaboy/kill_hadoop_orphans.sh
Shell script to kill orphaned Hadoop Task processes
View kill_hadoop_orphans.sh
#!/bin/bash
# Kill tasks holding on to deleted userlogs. These are most likely abandoned jobs.
function get_bad_pids {
for i in `ps -ef | grep java | awk '{print $2;}'`; do
cnt=`/usr/sbin/lsof -p $i | grep deleted | grep /var/log/hadoop-0.20/userlogs/attempt | wc -l`;
if [ $cnt -gt 0 ]; then
PIDS=$i:$PIDS;
fi
View gist:2322942
(require '[clj-http.client :as client])
(defn extract_domain [domain]
(println domain)
(let [unrolled_url (try (:trace-redirects (client/get domain {:throw-entire-message? true})) (catch Exception _ domain))]
(.getHost (java.net.URL. unrolled_url))))
(extract_domain "http://t.co/fDW8Gau")
@jtoy
jtoy / gist:1844519
Created Feb 16, 2012
this eats up all the memory on rsolr
View gist:1844519
require 'rsolr'
require 'thread'
require "optparse"
$opts = {}
Thread.abort_on_exception = true
threads = []
$q = Queue.new
@jtoy
jtoy / gist:1494874
Created Dec 19, 2011
kill em / redis / bloomfilter
View gist:1494874
require 'redis'
require 'redis/connection/synchrony'
require "em-synchrony/fiber_iterator"
require 'bloomfilter-rb'
max = 10_000
EM.synchrony do
LBF = BloomFilter::Redis.new(:size => max, :hashes => 2, :seed => 1,:namespace => "test")
process_queue = lambda do
Fiber.new{
View em-http-retry.rb
require 'em-http'
EM.run do
def dispatch(opts)
opts
puts opts
h = EM::HttpRequest.new(opts[:uri]).get
h.callback { |rep| opts[:cb].call(rep) if opts[:cb] }
You can’t perform that action at this time.