Skip to content

Instantly share code, notes, and snippets.

View Code-Hex's full-sized avatar

Kei Kamikawa Code-Hex

View GitHub Profile
@Code-Hex
Code-Hex / YAML.pl
Created August 22, 2014 02:18
YAML 上書き保存方法
use strict;
use YAML::XS;
my %h = ("12" => 4);
$h{foo} = "bar";
my @array = qw/apple banana orange/;
## YAMLドキュメントの読み込み
my $filename = YAML::XS::Load("example.yaml");
open F, '>>', $filename or die("cannot open file.");
@Code-Hex
Code-Hex / doublemap.pl
Created November 11, 2014 14:05
二重mapの動きを知るためのコード
#!/usr/bin/perl
use strict;
use warnings;
my $num = 0;
map{$num += $_} map{$num += $_} 1..2;
print $num;
@Code-Hex
Code-Hex / sort.py
Last active August 29, 2015 14:09
pythonでソート
#!/usr/bin/python
# coding: UTF-8
import random
a = range(10)
for i in range(10):
a[i] = random.randint(0,10)
print "a"
@Code-Hex
Code-Hex / oninto.pm
Created November 14, 2014 03:58
perl でライブラリを作ってみた。(多分随時更新)
use strict;
use warnings;
sub into(\@$$);
sub onto(\@$$);
sub into(\@$$){
my $i = 0;
my @new_array; # 新しい配列
my @before_array = @{$_[0]}; # 参照渡しされた配列を代入
@Code-Hex
Code-Hex / test.pl
Last active August 29, 2015 14:10
Mojolicious::Lite の勉強(基礎から)
#!/usr/bin/env perl
use Mojolicious::Lite;
# Documentation browser under "/perldoc"
plugin 'PODRenderer';
get '/' => sub {
my $c = shift;
$c->stash->{message} = "Hello Mojo!";
$c->stash->{test} = "Test Mojo...";
@Code-Hex
Code-Hex / HelloWorld.c
Last active August 29, 2015 14:11
mac上のgccで動きます
#define _____________ main
#define ____________ int
#define ___________ char
#define __________ while
#define _________ printf
#define ________ "%s\n"
#define _______ 115
#define ______ _==108?__[4]=___:_==111?__[5]=___:_==114?__[6]=___
_____________(){ ____________ _;___________ __[7];___________ *___;
@Code-Hex
Code-Hex / 4-2.c
Created December 17, 2014 03:04
4-2(4-1はやらない)
#include <stdio.h>
int main(){
for (int i = 1; i <= 7; ++i)
{
printf("*");
if (i % 3 == 1)
for (int i = 0; i < 4; ++i) printf("*");
printf("\n");
}
@Code-Hex
Code-Hex / 4-3.c
Last active August 29, 2015 14:11
4-3
#include <stdio.h>
int main(){
float vertically, horizontally;
float inch = 2.54;
float ans;
printf("まずは横の入力\n");
scanf("%f",&vertically);
@Code-Hex
Code-Hex / 5-1.c
Created December 17, 2014 03:42
5-1(5-2,5-3,5-4,5-5,5-6は計算できたら良いからパス)
#include <stdio.h>
int main(){
float f,c;
printf("摂氏の入力\n");
scanf("%f", &c);
f = (9 / 5 * c) + 32;
printf("華氏は%05f\n", f);
@Code-Hex
Code-Hex / 6-5.c
Last active August 29, 2015 14:11
6-5 閏年(超楽しい!)
#include <stdio.h>
int main(){
int year;
printf("この年は閏年--ver -0.1\n");
printf("気になる西暦を入力してね♡\n");
scanf("%d", &year);