Skip to content

Instantly share code, notes, and snippets.

View soruly's full-sized avatar
🐈
にゃー

ソ瑠璃(soruly) soruly

🐈
にゃー
View GitHub Profile
@soruly
soruly / update-up.mjs
Created June 16, 2024 10:36
Update Cloudflare IP address (IPv4 and IPv6)
#!/usr/bin/env node
import * as http2 from "node:http2";
import * as os from "node:os";
const CF_API = "https://api.cloudflare.com/client/v4";
const headers = {
"X-Auth-Email": "[email protected]",
"X-Auth-Key": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"Content-Type": "application/json",
@soruly
soruly / analyze.js
Created December 23, 2022 14:30
script to put ffprobe info to trace.moe api database
import "dotenv/config.js";
import child_process from "child_process";
import cluster from "cluster";
import fs from "fs-extra";
import Knex from "knex";
const { ANIME_PATH, DB_NAME, DB_USER, DB_PASS, DB_HOST } = process.env;
const knex = Knex({
@soruly
soruly / .env
Last active October 8, 2022 09:09
TELEGRAM_TOKEN= # e.g. 111111111:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
TELEGRAM_WEBHOOK= # e.g. https://your.host.com/
PORT= # (optional) Default: 3000
NOVELAI_TOKEN= # e.g. "Bearer eyJhbxxxxxxxxxxxxxXVCJ9.eyJpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbi9I"
@soruly
soruly / printscreen.ps1
Last active July 26, 2022 03:39
take screenshot of desktop every 15 seconds
Add-Type -AssemblyName System.Drawing
$timer = New-Object timers.timer
$timer.Interval = 15000
$timer.Enabled = $true
$timer.start()
Register-ObjectEvent -InputObject $timer -EventName Elapsed -SourceIdentifier PrintScreen -Action {
$folderName = Get-Date -Format "yyyy-MM-dd"
$fileName = "$(Get-Date -Format "yyyy-MM-dd HH mm ss").jpg"
@soruly
soruly / javascript-practice.md
Created April 1, 2021 06:58
Javascript Practice

Javascript Practice

Why?

  • Able to spot programming mistakes merely by reading code

  • Stop the try-and-error approach in programming (it works ≠ it is correct)

  • Improve instincts to what is the root cause of bugs

  • Speed up time for code review

  • Why?

  • Exercise 1: if(true)

@soruly
soruly / LireRequestHandler.java
Last active April 2, 2018 08:53
Various scripts that I used for whatanime.ga
/*
* This file is part of the LIRE project: http://www.semanticmetadata.net/lire
* LIRE is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* LIRE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@soruly
soruly / Scripts.md
Last active May 29, 2020 14:29
Various scripts for demo

Various scripts for demo

parallel-ping.go

Ping a few IP address in parallel with Go routine

sanitize-filename.sh

Check malformed filenames and rename with _

post_to_facebook_group.sh

Post a message to facebook group in shell script using HTTPie and jq

@soruly
soruly / compre.py
Last active June 15, 2023 14:38
Compare two images using OpenCV and SIFT in python
import cv2
import sys
import os.path
import numpy as np
def drawMatches(img1, kp1, img2, kp2, matches):
rows1 = img1.shape[0]
cols1 = img1.shape[1]
rows2 = img2.shape[0]