Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl
#
# ターミナル内で画像を表示するコマンド
# sshで作業しているときに謎の画像ファイルを確認したいけどいろいろメンドイときに便利.
#
# 仕様: 指定された画像をImagerでpnmに変換してaviewで表示するだけ.
# aviewを使用しているのでapt-get install aviewなどでインストールする.
# png,jpeg,gif等を読みたい場合にはImagerをインストールする前にlibpng-dev等を入れておく.
#
# スクリーンショット: http://www.udp.jp/g/10s.png http://www.udp.jp/g/m8.png
#
# twitterのfriendsのアイコンを
# アニメアイコンとアニメアイコン以外にフォルダわけするスクリプト
#
# 使い方
# 1. 必要なモジュールをcpan(windowsならppm)でインストール
#
# AnimeFaceはCPANに無いのでhttp://anime.udp.jp/imager-animeface.html#downloadinstall参考
# Windowsの場合は
# http://www.microsoft.com/downloads/details.aspx?FamilyID=a5c84275-3b97-4ab7-a40d-3802b2af5fc2&displaylang=en
#include "nv_core.h"
#include "nv_num_distance.h"
#if NV_ENABLE_SSE2
#include <emmintrin.h>
#include <xmmintrin.h>
#endif
// ユークリッド距離
float nv_euclidean(const nv_matrix_t *vec1, int m1, const nv_matrix_t *vec2, int m2)
{
#include "nv_core.h"
#include "nv_ml.h"
#include "nv_num.h"
// k-means
// 初期値選択
static void
nv_kmeans_init(nv_matrix_t *means, int k,
const nv_matrix_t *data)
// WB No.8のサンプルコード
/*
TCPを使ったリモートログイン用バックドア -- trbp --
動作確認は、x86 LinuxとMacOS X上で行っています
Linux : gcc trbp.c -lutil -Wall -o trbp
MacOS X: gcc trbp.c -Wall -o trbp
実行すると常駐するので消し忘れに注意してください
# モノクロ画像だけ移動させるコマンド
use strict;
use warnings;
use File::Copy qw/move/;
use File::Spec::Functions qw/catfile/;
my($src_dir, $move_dir) = @ARGV;
unless (defined($src_dir) && defined($move_dir)) {
die "usage $0 src_dir mono_dir\n";
}
// モノクロ画像なら0を返すコマンド
#include <stdio.h>
#if 0
#include "opencv/cv.h"
#include "opencv/cxcore.h"
#include "opencv/highgui.h"
#else
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
# アニメ顔切り取りスクリプト
use strict;
use warnings;
use Imager;
use Imager::AnimeFace;
use File::Spec::Functions;
use List::Util qw/min max/;
use Storable qw/nstore/;
use constant {
FACE_THRESHOLD => 0.7, # 顔検出の閾値(0.5~1.0) 高いほど厳しい
# bou_imouto_crawler
use strict;
use warnings;
use Web::Scraper;
use URI;
use Data::Dumper;
use LWP::UserAgent;
use constant {
TAG_FILE => './tags.txt', # 手動で用意
MAX_PAGE => 10
// MNIST: bag of keypoints
#include "nv_core.h"
#include "nv_ml.h"
#include "nv_io.h"
#include "nv_num.h"
#include "cxcore.h"
#include "cv.h"
#include "highgui.h"
#include "nv_face_feature.h"