Skip to content

Instantly share code, notes, and snippets.

View mayth's full-sized avatar

Mei Akizuru mayth

View GitHub Profile
@mayth
mayth / Dockerfile
Last active December 14, 2023 18:49
Script for installing Adoptium Temurin JDK
ARG base_image=centos:7
FROM $base_image
ARG jdk_version=8
ARG jdk_arch=x64
ARG jdk_platform=linux
ARG sbt_version=1.9.8
# setup java
ADD ./install_jdk.sh .
@mayth
mayth / scan.rb
Created April 23, 2018 17:30
オープンクラス最高! 一番好きなクラスです!
class Array
def scan(init, &op)
res = Array.new(self.length)
m = init
self.each_with_index do |x, i|
acc = op.call(m, x)
res[i] = acc
end
res
end
@mayth
mayth / apcluster.rb
Created August 4, 2014 08:27
Affinity Propagation with Ruby. To run: `ruby apcluster.rb small_toyproblem.txt`.With `small_toyproblem.txt`, the expected content of the exemplars array is '[3, 3, 3, 3, 5]'.
# Provides the implementation of Affinity Propagation
class AffinityPropagation
DEFAULT_DAMPFACT = 0.9
DEFAULT_CONVERGENCE_ITERATION = 10
DEFAULT_MAX_ITERATION = 2000
attr_reader :preference, :min_similarity, :max_similarity, :med_similarity
def initialize(
dampfact = DEFAULT_DAMPFACT,
@mayth
mayth / ec_campaign.cs
Created December 2, 2013 08:37
新人女子プログラマの書いたコードを直すだけの簡単なお仕事です!|paizaオンラインハッカソンVol.1 https://paiza.jp/poh/ec-campaign
using System;
using System.Collections.Generic;
using System.Linq;
namespace Paiza
{
static class Program
{
public static void Main(string[] args)
{
@mayth
mayth / assets.rake
Created November 27, 2013 10:37
Rake tasks to pre-compile assets.
require 'bundler/setup'
Bundler.require(:default, :assets)
require 'rake/sprocketstask'
Rake::SprocketsTask.new do |t|
root = File.join(Dir.pwd, 'app')
env = Sprockets::Environment.new(root)
env.append_path 'assets/javascripts'
env.append_path 'assets/stylesheets'
env.append_path 'assets/images'
@mayth
mayth / electrical_ayafmy.rb
Created November 12, 2013 12:16
ふみふみ
def rate(x)
case x
when 0..120
x * 18.10 + 790
when 121..250
120 * 18.10 + (x - 120) * 24.25 + 790
else
120 * 18.10 + 130 * 24.25 + (x - 250) * 27.45 + 790
end
end
@mayth
mayth / SkillAnalyzer.il
Created October 1, 2013 15:13
tkbctf2 Bin350: SkillAnalyzer Written by Mei Akizuru (@maytheplic), obfuscated by op (@6f70).
.assembly extern mscorlib {}
.assembly extern System.Core {}
.assembly 'Fuji Safari Park' {}
.field static unsigned int8[] a // prm
.field static unsigned int8[] b // flg
.field static unsigned int8[] c // scr
.method public static void critical_line(string)
{
@mayth
mayth / string.c
Last active December 21, 2015 13:59
Modification for Ruby Interpreter and Extension Library (Report of Software Science Special Lecture C) College of Information Science University of Tsukuba
/**********************************************************************
string.c -
$Author$
created at: Mon Aug 9 17:12:58 JST 1993
Copyright (C) 1993-2007 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agency, Japan
@mayth
mayth / userstream.rb
Last active December 20, 2015 05:29
Twitter User Stream
require 'oauth'
require 'yaml'
require 'yajl'
# UserStream takes events or statuses from UserStreaming API.
class UserStream
# The default value of User-Agent.
DEFAULT_USER_AGENT = 'RbUserStreamClient/1.0'
def initialize(provider, cred, screen_name, ca_file_path, user_agent = DEFAULT_USER_AGENT)
@mayth
mayth / Diva.fs
Last active December 17, 2015 00:19
tkbctf1: Diva (Bin200)
// Diva
// See the definition of Inst, supported instructions.
open FParsec
type Parser<'a> = Parser<'a, unit>
let test p str =
match run p str with
| Success(result, _, _) -> printfn "Success: %A" result