Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
my ($old_file, $new_file) = @ARGV;
if (!defined $old_file || !defined $new_file) {
die "You must give two file names via command line argument";
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use File::chdir;
use File::Temp qw/tempdir/;
use File::Copy qw/move/;
use Text::Iconv;
use Excel::Writer::XLSX;
orig_program_name = $0
(1..100).each do |i|
# do something
sleep 0.1
# ここでプログラム名上書きして進捗を追加
$0 = "#{orig_program_name}(#{i}%)"
end
my $lpnum = 1;
for ($i++; $token = $tokens->[$i]; $i++) {
$token_type = $token->{type};
if ($token_type == LEFT_PAREN) {
$lpnum++;
}
elsif ($token_type == RIGHT_PAREN) {
last if --$lpnum <= 0 ;
}
# ここでてきとうに処理する
@moznion
moznion / cpanize_minil.md
Last active August 29, 2015 14:07
Minilla使ってCPANにブツを上げる

ホームディレクトリに.pauseというファイルを作る

$ vi ~/.pause

以下のように書く

user USER_NAME
2014/09/18 11:49:12 [FAIL] //h2/text() match Hello\s+isucon79\!
2014/09/18 11:49:12 %v <!DOCTYPE html>
<html lang="en" class="">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Language" content="en">
#define CUDA_SAFE_CALL(func) \
do { \
cudaError_t err = (func); \
if (err != cudaSuccess) { \
fprintf(stderr, "[Error] %s (error code: %d) at %s line %d\n", cudaGetErrorString(err), err, __FILE__, __LINE__); \
exit(err); \
} \
} while(0)
#include <stdio.h>
int main(int argc, char** argv) {
cudaError_t err;
char *device_name = "Quadro K6000";
int device_count;
err = cudaGetDeviceCount(&device_count);
if (err) {
#include <stdio.h>
#define DATA_NUM 1024
#define DATA_SIZE sizeof(double) * DATA_NUM
#define BLOCK_SIZE 128
#define TRIALS 100
void cudaSetDeviceSafe(int);
void cudaMallocSafe(void*, int);
void cudaMallocHostSafe(void*, int);
#include <stdio.h>
#define DATA_NUM 10
#define DATA_SIZE sizeof(double) * DATA_NUM
#define TRIALS 50
void cudaSetDeviceSafe(int);
void cudaMallocSafe(void*, int);
void cudaMallocHostSafe(void*, int);
void cudaMemcpySafe(void*, const void*, size_t, cudaMemcpyKind);