Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Wanna work abroad

Yuki Hirai yukihirai0505

:octocat:
Wanna work abroad
View GitHub Profile
View HogeService.java
package com.example.hoge;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
class HogeService {
@yukihirai0505
yukihirai0505 / AutoRestartScriptForIdexD.md
Last active Jun 14, 2019
auto-restart scripts for IdexD
View AutoRestartScriptForIdexD.md

Get Started

Create cronjob.env.sh to load nvm

#!/bin/bash

# NVM needs the ability to modify your current shell session's env vars,
# which is why it's a sourced function
export NVM_DIR="/home/<username>/.nvm"
@yukihirai0505
yukihirai0505 / deleteDiscordMessages.js
Created Jun 12, 2019 — forked from victornpb/deleteDiscordMessages.js
Delete all your messages from DM or Channel in Discord
View deleteDiscordMessages.js
let authToken = ''
let authorId = document.body.appendChild(document.createElement`iframe`).contentWindow.localStorage.user_id_cache.replace(/"/g, "")
let channelId = window.location.href.split('/').pop()
let afterMessageId = ''
/**
* Delete all messages in a Discord channel or DM
*/
function deleteMessages() {
const start = new Date();
@yukihirai0505
yukihirai0505 / 01_verify.ride
Last active Jun 19, 2019
WAVES IDE Mocha Test
View 01_verify.ride
{-# STDLIB_VERSION 3 #-}
{-# CONTENT_TYPE DAPP #-}
{-# SCRIPT_TYPE ACCOUNT #-}
let senderPk = base58'hoge'
@Verifier(tx)
func verify() = {
match tx {
case d: SetScriptTransaction => sigVerify(tx.bodyBytes, tx.proofs[0], senderPk)
case d: DataTransaction => sigVerify(tx.proofs[0], tx.bodyBytes, senderPk)
case _=> false
@yukihirai0505
yukihirai0505 / cloc.sh
Created May 7, 2019
Counting lines of code (specific directories and files)
View cloc.sh
#!/usr/bin/env bash
# cloc ver
MODULES=(hoge fuga piyo)
for MODULE in "${MODULES[@]}"
do
TARGET_DIC=./${MODULE}
cloc ${TARGET_DIC} --read-lang-def=$HOME/cloc/language-defs.txt --include-lang=Java,PHP | awk -v env_var="${MODULE}" 'FNR == 12 {print "|" env_var "|" $3+$4+$5 "|" $4+$5 "|"}'
@yukihirai0505
yukihirai0505 / Nampa.java
Last active Feb 27, 2019
The Theory of Nampa ... Nampa is like "hit on" , "pick up", "flirt", "try to get with", "mack", "chat up" etc.
View Nampa.java
package com.example;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Random;
class NampaMan {
private int nampaCount = 0;
@yukihirai0505
yukihirai0505 / slack_attachements.go
Created Feb 18, 2019
Go Slack postMessage (attachements ver)
View slack_attachements.go
package slack
import (
"bytes"
"encoding/json"
"net/http"
"net/url"
"os"
)
@yukihirai0505
yukihirai0505 / wp_offload_s3_migration.md
Created Jan 24, 2019
WP Offload S3 Liteを導入したときに既存の画像をS3にアップロードしてpostmetaも追加する
View wp_offload_s3_migration.md

まずS3にファイルをごっそり移動 すでにプラグイン導入後にS3登録済みの画像も一緒に登録されるがおかまいなし

aws configure
aws s3 sync wp-content/uploads/ s3://your-bucket-name/wp-content/uploads/

この記事によるとwpコマンドを使用するのが美しいとあるがいかんせん遅い -> より美しくWP Offload S3 Liteに既存のメディアを登録する方法

@yukihirai0505
yukihirai0505 / 01_coin-regular-investment.md
Last active Sep 8, 2020
ZaifのAPIを使用してイーサリアム(ETH)とネム(XEM)を指値注文するためのGoogle Apps Script
View 01_coin-regular-investment.md

Get Started

スプレッドシートを用意して シートの名前を zaif に設定

ZaifのAPIキーやシークレット、積立したい金額を入力

dglxcxuvaaeipji

@yukihirai0505
yukihirai0505 / 01_coin-regular-investment.md
Last active Jun 22, 2018
bitbankのAPIを使用してリップルとモナコイン を成行買いするためのGoogle Apps Script
View 01_coin-regular-investment.md

Get Started

スプレッドシートを用意して シートの名前を bitbank に設定

bitbankのAPIキーやシークレット、積立したい金額を入力

dglxcxuvaaeipji

You can’t perform that action at this time.