Skip to content

Instantly share code, notes, and snippets.

View kozo2's full-sized avatar

Kozo Nishida kozo2

View GitHub Profile
@ytbilly3636
ytbilly3636 / chainer-som.py
Created May 17, 2017 07:27
ChainerでSOM?
# -*- coding: utf-8 -*-
import cv2
import numpy as np
import chainer
import chainer.links as L
from chainer import Chain, Variable
from chainer import datasets
class SOM(Chain):
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ax3l
ax3l / noglobal.py
Last active May 8, 2024 22:23
Useful Noglobal in Python
# License:
# I hereby state this snippet is below "threshold of originality" where applicable (public domain).
#
# Otherwise, since initially posted on Stackoverflow, use as:
# CC-BY-SA 3.0 skyking, Glenn Maynard, Axel Huebl
# http://stackoverflow.com/a/31047259/2719194
# http://stackoverflow.com/a/4858123/2719194
import types
WARNING: old DATASOURCENAME 'HMDB36CHEBI' doesn't match new DATASOURCENAME 'HMDB-CHEBI-WIKIDATA'
INFO: Lm is only in new database
INFO: Number of ids in Lm: 2565
INFO: Number of ids in Wd (Wikidata): 21293 (3208 added, 152 removed -> overall changed +16.8%)
INFO: Number of ids in Ck (KEGG Compound): 15941 (51 added, 6 removed -> overall changed +0.3%)
INFO: Number of ids in Wi (Wikipedia): 4731 (745 added, 5 removed -> overall changed +18.5%)
INFO: Number of ids in Kd (KEGG Drug): 2006 (270 added, 670 removed -> overall changed -16.6%)
WARNING: Number of ids in Kd has shrunk by more than 10%
INFO: Ik is only in new database
INFO: Number of ids in Ik: 41392
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
### Dockerfile
FROM ubuntu
RUN apt-get update && apt-get install -yq xvfb
ADD xvfb-run-wrapper.sh /bin/xvfb-run-wrapper.sh
RUN chmod +x /bin/xvfb-run-wrapper.sh
ENTRYPOINT ["/bin/xvfb-run-wrapper.sh", "/bin/sleep"]
CMD ["10000"]
###
### xvfb-run-wrapper.sh
@cannin
cannin / basicTraversal_3.groovy
Last active November 28, 2024 05:39
BioPAX Tutorial; Examples from the Paxtools User's Guide. (PubMed ID: 24068901 Link: https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003194)
//BASIC TRAVERSAL
// Get names for all elements in a BioPAX OWL file and then for just Proteins
import org.biopax.paxtools.io.BioPAXIOHandler;
import org.biopax.paxtools.io.SimpleIOHandler;
import org.biopax.paxtools.model.Model;
import org.biopax.paxtools.model.BioPAXElement;
import org.biopax.paxtools.model.level3.Protein;
// Load a sample test BioPAX File via Simple IO Handler
InputStream f = new FileInputStream(new File("data/biopax3-short-metabolic-pathway.owl"));
machinectl pull-tar --verify=no http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20150528.tar.bz2
@danielgtaylor
danielgtaylor / gist:0b60c2ed1f069f118562
Last active May 2, 2025 15:13
Moving to ES6 from CoffeeScript

Moving to ES6 from CoffeeScript

I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.

In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.

While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.

Punctuation

Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio