Skip to content

Instantly share code, notes, and snippets.

Avatar
😇
INNOCENT

KOHMURA Jin jadiunr

😇
INNOCENT
View GitHub Profile
@jadiunr
jadiunr / get_all_own_repositories.sh
Created Jul 27, 2021
リポジトリ全部抜く
View get_all_own_repositories.sh
#!/bin/bash
# Usage: ./get_all_own_repositories.sh <your github token>
# Requirements: jq, ghq
TOKEN=$1
PAGE=1;
while true; do
REPOS=`curl -sS -H "Authorization: Bearer $TOKEN" -H 'Accept: application/vnd.github.v3+json' https://api.github.com/user/repos?page=$PAGE | jq -r .[].ssh_url`
if [ -z "$REPOS" ]; then
exit
@jadiunr
jadiunr / delete_all_private_statuses.pl
Last active Apr 5, 2020
Mastodonの鍵トゥを片っ端から消して回るスクリプト 自己責任
View delete_all_private_statuses.pl
use strict;
use warnings;
use utf8;
use Furl;
use JSON qw/decode_json/;
$|=1;
my $domain = '<YOUR MASTODON DOMAIN>';
my $access_token = '<YOUR MASTODON ACCESS TOKEN>';
View abc136_d.pl
use strict;
use warnings;
use feature 'say';
use Data::Dumper;
my $S = <>; chomp($S);
my $out = [];
for my $S_group ($S =~ /(R+L+)/g) {
my $r_children = 0;
@jadiunr
jadiunr / sieve_of_eratosthenes.pl
Created Jun 29, 2019
エラトステネスの篩
View sieve_of_eratosthenes.pl
use strict;
use warnings;
my $n = $ARGV[0] || 1000;
my $nums = [2..$n];
my $p_index = 0;
while (1) {
my $p = $nums->[$p_index++];
last if $p > sqrt($n);
@jadiunr
jadiunr / purger.pl
Last active Jun 10, 2019
FF外から失礼する奴を粛清するやつ APIが一瞬で枯渇するので使えません
View purger.pl
use strict;
use warnings;
use utf8;
use feature 'say';
use Net::Twitter;
my $api = Net::Twitter->new(
traits => [qw/API::RESTv1_1/],
consumer_key => $ENV{PURGER_TWITTER_CK},
consumer_secret => $ENV{PURGER_TWITTER_CS},
View tennichi_scraping.pl
use strict;
use warnings;
use utf8;
use feature 'say';
use Furl;
use Mojo::DOM;
my ($http, $url, $results) = (Furl->new, 'https://shindanmaker.com/832038', []);
for my $count (1..1e6) {
View keisuke_honda.pl
use strict;
use warnings;
use feature 'say';
use POSIX 'ceil';
use Time::Piece;
use Time::Seconds;
my $count = ceil(log(0.5) / log((shift(@ARGV) or 99.95) * 0.01));
my $begin_date = (Time::Piece->strptime("2019-05-01","%Y-%m-%d") - ONE_DAY * $count)->ymd;
View fibonacci.pl
use strict;
use warnings;
use feature 'say';
my ($num1,$num2) = (1,1);
for my $i (1..(shift(@ARGV) or 1000)) {
say "[$i]: ", 1 and next if grep {$_ == $i} (1,2);
say "[$i]: ", $num1 = $num1 + $num2 if $i % 2 == 0;
say "[$i]: ", $num2 = $num1 + $num2 if $i % 2 == 1;
}
View erajudge.pl
use strict;
use warnings;
use utf8;
use Time::Piece 'localtime';
use JSON::XS 'decode_json';
use Encode 'encode_utf8';
my $eras = decode_json(encode_utf8 '[{"date":"0650/02/15","era":"白雉"},{"date":"0686/07/20","era":"朱鳥"},{"date":"0701/03/21","era":"大宝"},{"date":"0704/05/10","era":"慶雲"},{"date":"0708/01/11","era":"和銅"},{"date":"0717/11/17","era":"養老"},{"date":"0724/02/04","era":"神亀"},{"date":"0729/08/05","era":"天平"},{"date":"0749/04/14","era":"天平感宝"},{"date":"0749/07/02","era":"天平勝宝"},{"date":"0757/08/18","era":"天平宝字"},{"date":"0765/01/07","era":"天平神護"},{"date":"0767/08/16","era":"神護景雲"},{"date":"0770/10/01","era":"宝亀"},{"date":"0781/01/01","era":"天応"},{"date":"0782/08/19","era":"延暦"},{"date":"0810/09/19","era":"弘仁"},{"date":"0824/01/05","era":"天長"},{"date":"0834/01/03","era":"承和"},{"date":"0848/06/13","era":"嘉祥"},{"date":"0851/04/28","era":"仁寿"},{"date":"0854/11/30","era":"斎衡"},{"date":"0857/02/21","era":"天安"},{"date":"0859/04/15","era":"貞観"},{"date":"0877/04/16","era":"元慶"},{"date":"0885/02/21","era":"仁和"}
View myquine.rb
n=2;eval$s=%w[s=%[n=#{n<3?n+1:
1};eval$s=%w[#{$s}]*""];f=->n{
s.slice!(0,n)};if(n==1)then;6.
times{|i|puts(f[30])};20.times
{|i|puts(32.chr*15+f[15])};els
if(n==2)then;4.times{puts(f[30
])};4.times{|i|
puts(32.chr*19+
f[11])};4.times
{puts(f[30])};4