Skip to content

Instantly share code, notes, and snippets.

View jiftechnify's full-sized avatar
🏠
Working from home

Takumi Fujiwara jiftechnify

🏠
Working from home
View GitHub Profile
@jiftechnify
jiftechnify / min_nostr_client.js
Created February 9, 2024 23:35
minimum Nostr client
const minNostrClient = () => {
const ws = new WebSocket("wss://yabu.me");
ws.onopen = () => {
ws.send(JSON.stringify(["REQ", "sub", { "kinds": [1], "limit": 10 }]));
}
ws.onmessage = (e) => {
console.log(JSON.parse(e.data)[2].content);
}
}
minNostrClient();
package bfinterp
import scala.collection.mutable
import scala.io.StdIn
object PlainOldBrainfuckInterpreter {
private def printChar(i: Int): Unit = {
print(i.toChar)
}

Keybase proof

I hereby claim:

  • I am jiftechnify on github.
  • I am jiftechnify (https://keybase.io/jiftechnify) on keybase.
  • I have a public key ASBYcbZu5Lh3n1s5_1n75TLtdR7yCp7oPMbIsJ1Assu3mwo

To claim this, I am signing this object:

openpgp4fpr:2B5188D6E094B91FF21FCE20009040DA8C4F544C

@jiftechnify
jiftechnify / post.ts
Created April 19, 2023 02:28
post text to a Nostr relay
import {
Event,
Relay,
UnsignedEvent,
getEventHash,
getPublicKey,
nip19,
relayInit,
signEvent,
} from "nostr-tools";
{"lastUpload":"2022-01-14T05:53:41.672Z","extensionVersion":"v3.4.3"}
interface Span {
start: number;
end: number;
}
const removeRangeAndInsert = <T extends unknown>(
arr: T[],
from: number,
until: number,
newElem: T
@jiftechnify
jiftechnify / hmac.go
Created October 25, 2018 13:49
HMAC sample in Golang
func main() {
key := []byte("hogefugapoyopoyopoyo")
text := []byte("text")
mac1 := hmac.New(sha256.New, key)
c1 := mac1.Sum(text)
fmt.Println(c1)
fmt.Println(base64.StdEncoding.EncodeToString(c1))
mac2 := hmac.New(sha256.New, key)
@jiftechnify
jiftechnify / jkp.js
Last active March 14, 2016 07:20
情工戦闘力を計算するやつ(教務webの成績閲覧のページで実行してください)
javascript:(function(d){var a=parseFloat(d.getElementById("ctl00_ContentPlaceHolder1_ctl00_trAveTotal").cells[1].innerText);var b=d.getElementsByClassName("tdSpace").length+d.getElementsByClassName("tdSpaceAlt").length;var p=Math.round((a+b*0.2)*100)/100;alert("平均点:"+a+", 修得済み科目数:"+b+", 戦闘力:"+p);})(document)