Skip to content

Instantly share code, notes, and snippets.

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

ka kaosf

🏠
Working from home
View GitHub Profile
@kaosf
kaosf / nostr-rabbit-dark-theme.css
Last active March 24, 2024 11:55
My Dark Theme CSS for Rabbit (one of Nostr client)
body {
background-color: #202732;
color: #c7c7c7;
}
a {
color: #7770f0;
}
a:visited {
color: #aaaaee;
}
@kaosf
kaosf / erc20.sol
Created October 20, 2023 16:25
ERC20 note
pragma solidity ^0.6.0;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; }
contract TokenERC20 {
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;
@kaosf
kaosf / mattn-token-info.txt
Created October 21, 2023 17:18
MATTN token information
On Polygon network only
Contract address: `0xc8f48E2b873111aA820463915b3a637302171d61`
Total supply: 5,000,000,000,000,000
Total supply (ja): 5000兆
QuickSwap
MATTN-MATIC pair: https://quickswap.exchange/#/swap?swapIndex=0&currency0=ETH&currency1=0xc8f48E2b873111aA820463915b3a637302171d61
@kaosf
kaosf / coingecko-price-history.sh
Last active March 24, 2024 11:53
Get cryptocurrency price history with CoinGecko
# Get every month (almost) open price.
# Bash, curl and jq are required.
# Modify YEAR, ID, +09:00 and jpy for yourself.
YEAR=2023
ID=bitcoin
for MONTH in $(seq -w 1 12); do
FROM=$(date --date="${YEAR}-${MONTH}-01T00:00:00+09:00" +"%s")
TO=$( date --date="${YEAR}-${MONTH}-01T01:00:00+09:00" +"%s")
FILENAME=${YEAR}-${MONTH}.json
@kaosf
kaosf / index.js
Created July 4, 2023 14:26
Nostr backup experimental code version 20230704
// ka's nostr backup experimental code version 20230704
const WebSocketClient = require("websocket").client;
const client = new WebSocketClient();
client.on('connectFailed', function(error) {
console.log('Connect Error: ' + error.toString());
});
@kaosf
kaosf / how-to-run-bitcoind-with-tor.md
Created July 7, 2023 05:30
How to run `bitcoind` with systemd and Tor

On Arch Linux.

sudo pacman -S bitcoin-daemon tor

sudo systemctl enable tor.service
sudo systemctl start tor.service

Create /etc/systemd/system/bitcoin.service.

const [keyword, type] = ["大空あかり", "キャラ"];
// const [keyword, type] = ["穏やかじゃない", "セリフ"]
import * as fs from "fs";
import * as path from "path";
import { parse } from "csv-parse/sync";
const source = path.join(__dirname, "aikatsup20230422.csv");
const buffer = fs.readFileSync(source);
const rows = parse(buffer, { relax_column_count: true }) as string[][];
@kaosf
kaosf / aikatsup.ts
Created May 26, 2023 15:24
AikatsUP search core by TypeScript
import * as fs from "fs";
import * as path from "path";
import { parse } from "csv-parse/sync";
import * as crypto from "crypto";
import * as http from "http";
import * as https from "https";
const filepath = path.join(__dirname, "aikatsup20230422.csv");
const expected_sha256 =
"14648f557a2ad394b513c0800afd3b1f4d1ee23964f501820a392cb6779a9a19";
@kaosf
kaosf / aikatsup-characters.txt
Created May 26, 2023 11:36
AikatsUP characters list
星宮いちご
霧矢あおい
紫吹蘭
有栖川おとめ
藤堂ユリカ
北大路さくら
一ノ瀬かえで
神谷しおん
音城セイラ
冴草きい
@kaosf
kaosf / aikatsup.rb
Created May 26, 2023 11:21
AikatsUP search core by Ruby
require "digest"
require "open-uri"
FILEPATH = "./aikatsup20230422.csv"
EXPECTED_SHA256 = "14648f557a2ad394b513c0800afd3b1f4d1ee23964f501820a392cb6779a9a19"
def download_from_github_and_succeeded
URI.open("https://raw.githubusercontent.com/kaosf/AikatsuDOWN/master/data/aikatsup20230422.csv") do |file|
File.open(FILEPATH, 'wb') do |output|
output.write(file.read)