Skip to content

Instantly share code, notes, and snippets.

View ktnyt's full-sized avatar
🐱

ktnyt ktnyt

🐱
View GitHub Profile
@ktnyt
ktnyt / rgbcondition.pde
Created July 7, 2014 11:14
RGB condition
import processing.video.*;
Capture camera;
PImage picture = null;
void setup() {
size(640, 480);
camera = new Capture(this, 640, 480, 30);
camera.start();
@ktnyt
ktnyt / rgbcondition-global.pde
Last active August 29, 2015 14:03
Global RGB condition
import processing.video.*;
Capture camera;
PImage picture = null;
void setup() {
size(640, 480);
camera = new Capture(this, 640, 480, 30);
camera.start();
@ktnyt
ktnyt / kadai3.sh
Last active August 29, 2015 14:03
perl -lane '$.-1?$h{$_}=$F[7]:print"(answer1)\n$_"}{print join"\n",sort{$h{$b}<=>$h{$a}}keys%h' datas
perl -F'\t' -lane '$.-1?$F[4]?push@{$h{$F[0]}},[$F[4],$F[2],$F[5]]:"":print"(answer2)"}{map{print"[$_]"and map{print join":",@$_ if@$_}(sort{$b->[0]<=>$a->[0]}sort{$a->[1]<=>$b->[1]}@{$h{$_}})[0..4]}sort{$a cmp$b}keys%h' datas
perl -lane '$.-1?sub{$h{$1}++while/https?:\/\/(.+?)\//g}->():print"(answer3)"}{print join"\n",(map{join":",@$_}sort{$b->[0]<=>$a->[0]}map{[$h{$_},$_]}sort{$a cmp$b}keys%h)[0..4]' datas;
@ktnyt
ktnyt / gist:8a60c064519c04ba8e96
Created August 11, 2014 22:18
神クエリ for 7yan
SELECT DISTINCT *
WHERE {
?person rdf:type <http://dbpedia.org/ontology/Person> .
?person prop-ja:バスト ?b .
?person prop-ja:ウエスト ?w.
?person prop-ja:ヒップ ?h.
?person <http://ja.dbpedia.org/property/生年> ?birthYear .
?person rdfs:label ?label .
?person dbpedia-owl:wikiPageWikiLink dbpedia-ja:日本 .
?person dbpedia-owl:wikiPageWikiLink dbpedia-ja:ジュニアアイドル
@ktnyt
ktnyt / bcht.pl
Last active August 29, 2015 14:05
Best codon hashtable
use strict;
use warnings;
use G;
my $gb = load("ecoli", "no msg");
my $w_val = w_tai($gb, -output=>"f", -filename=>"/dev/null");
my $table;
@ktnyt
ktnyt / get_userstatus
Created October 20, 2014 06:31
Gets user status for given user
use strict;
use warnings;
use utf8;
use Encode;
use Scalar::Util 'blessed';
use Net::Twitter;
my $username = shift;
@ktnyt
ktnyt / mztab_annotate.pl
Last active August 29, 2015 14:09
mzTab Annotator - picks up "opt_global_kegg" column to automatically annotate SML lines
#!/usr/bin/env perl
###############################################################################
#
# Modules
#
use strict;
use warnings;
use utf8;
use POSIX;
@ktnyt
ktnyt / polish.pl
Created December 15, 2014 04:01
Polish Notation
use strict;
use warnings;
print p([@ARGV]), "\n";
sub p {
my $e = shift;
my $s = shift @{$e};
return p($e) + p($e) if $s eq "+";
return p($e) - p($e) if $s eq "-";
@ktnyt
ktnyt / permute.pl
Created January 15, 2015 17:08
Perl Array Permutation
use strict;
use warnings;
my @list = qw(1 2 3 4);
my @p = permute([@list], []);
foreach my $s (map{join("\t", @{$_})}@p) {
printf("%s\n", $s);
}
sub permute {
@ktnyt
ktnyt / genbankn_batch_downloader.pl
Created June 22, 2015 07:31
Batch download GENBANK entries via TogoWS.
#!/usr/bin/env perl
use strict;
use warnings;
my $base = "togows.dbcls.jp/entry/nucleotide";
my ($prefix, $from_id, $to_id) = (@ARGV);
if($from_id > $to_id) {
($from_id, $to_id) = ($to_id, $from_id);