Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jtoy's full-sized avatar

jtoy

View GitHub Profile
--[[ Wrecking ball suspended from rope. Cyrus-free.
Making realtime rope simulation is finicky on any physics engine. At certain weight the force becomes
too much to be successfully distributed among rope elements.
Some steps that can help solve the issue:
1) lower the mass of suspended weight or lower the gravity constant
2) increase mass of each rope element, preferably having more mass at top of rope and less mass at bottom
3) decrease number of rope elements
4) decrease the simulation time step
--[[ Wrecking ball suspended from rope. Cyrus-free.
Making realtime rope simulation is finicky on any physics engine. At certain weight the force becomes
too much to be successfully distributed among rope elements.
Some steps that can help solve the issue:
1) lower the mass of suspended weight or lower the gravity constant
2) increase mass of each rope element, preferably having more mass at top of rope and less mass at bottom
3) decrease number of rope elements
4) decrease the simulation time step
@jtoy
jtoy / gist:2fee28d8931de0ce6b5883e4b5658560
Created March 3, 2018 18:26
Coach tensorflow cpu - Dockerfile
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 December 26, 2017 04:50 — forked from eevee/perlin.py
Perlin noise in Python
"""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.
@jtoy
jtoy / etst
Created March 11, 2017 21:38
test
setestsetset
est
se
t
est
se
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,
;; 訓練データ
(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 April 28, 2012 16:57 — forked from dvryaboy/kill_hadoop_orphans.sh
Shell script to kill orphaned Hadoop Task processes
#!/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
(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 February 16, 2012 12:28
this eats up all the memory on rsolr
require 'rsolr'
require 'thread'
require "optparse"
$opts = {}
Thread.abort_on_exception = true
threads = []
$q = Queue.new