Skip to content

Instantly share code, notes, and snippets.

View spiegel-im-spiegel's full-sized avatar
😀
being hired

Spiegel spiegel-im-spiegel

😀
being hired
View GitHub Profile
import unittest
def multiple3_5(high:int) -> int:
sum = 0
for i in range (1, high):
if i % 3 == 0:
sum += i
elif i % 5 == 0:
sum += i
return sum
@suzujun
suzujun / program_number_type.md
Last active February 27, 2023 12:57
言語間の整数型範囲まとめ

signed: 符号あり

数値範囲 mysql java golang javascript
-128 ~ 127 tinyint byte int8 -
-32768 ~ 32767 smallint short int16 -
-8388608 ~ 8388607 mediumint (int) (int32) -
-2147483648 ~ 2147483647 int int int32 -
-9223372036854775808 ~ 9223372036854775807 bigint long int64

※カッコは補うためのタイプ

@hyuki0000
hyuki0000 / a.rb
Created January 25, 2017 12:41
冪乗
def f(n,m)
if n == 0
1
else
m * f(n-1,m)
end
end
puts "f(2,2) = #{f(2,2)}"
puts "f(10,2) = #{f(10,2)}"
@mtsukamoto
mtsukamoto / Tabelog_IsSmokeFree.pl
Created June 11, 2016 17:16
リスト中の食べログURLを取得し「店名」「営業時間」「禁煙・喫煙」などを出力
use strict;
use warnings;
use utf8;
use Encode;
use Web::Scraper;
use URI;
my ($opts, @urls) = &parse_args(@ARGV);
@hyuki0000
hyuki0000 / ni.rb
Created April 8, 2016 14:31
von Neumann Integer.
class Fixnum
def to_ss
if self == 0
""
elsif self == 1
"{}"
else
(self - 1).to_ss + ',' + (self - 1).to_s
end
end
@hyuki0000
hyuki0000 / replace_http_with_https.rb
Last active February 7, 2016 02:39
大量のmarkdownファイルの http://img.textfile.org/https://img.textfile.org/ に書き換えるため作ったもの。
#!/usr/bin/env ruby
# encoding: utf-8
Dir.glob("source/*.md").each do |md|
open("#{md}.txt", "w") do |wf|
open(md) do |rf|
rf.readlines.each do |line|
if line.match(%r(http://img\.textfile\.org/))
line.gsub!(%r(http://img\.textfile\.org/), "https://img.textfile.org/")
end
@tucnak
tucnak / i-love-interfaces.go
Created October 28, 2015 09:06
Nil errors are not always nil :)
package main
import "fmt"
type MagicError struct{}
func (MagicError) Error() string {
return "[Magic]"
}
@tyochiai
tyochiai / conversion.go
Last active May 4, 2020 06:58
ShiftJIS -> EUC-JP by golang
package conversion
import (
"io"
"golang.org/x/text/encoding/japanese"
"golang.org/x/text/transform"
)
//Conversion
@mtsukamoto
mtsukamoto / excel2csvs.pl
Created June 29, 2015 06:40
Excelファイル内の全シートをCSV保存するPerlスクリプト
#!perl
# Written by Makio Tsukaoto (tsukamoto at gmail.com)
use strict;
use warnings;
use File::Spec;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Excel';
our $VERSION = "0.01";
@aclements
aclements / scale.go
Created June 26, 2015 15:07
Scale down by 2x using x/image/draw
package main
import (
"flag"
"fmt"
"image"
"image/png"
"log"
"os"