Skip to content

Instantly share code, notes, and snippets.

@anemochore
anemochore / convert a txt file containing a tex per line to pdfs.py
Last active March 7, 2024 06:52
py script that converts a txt file containing a tex per line to multiple pdf files
import subprocess
import os
# sample of input_file:
# $\mathbf{x}\in \mathbb{R}^d$
# $x_i\in \mathbb{R}$
# $D=\{\mathbf{x}^{(1)},\mathbf{x}^{(2)},\ldots, \mathbf{x}^{(N)}\}$
# ...
# consts
@anemochore
anemochore / searchJw.js
Created June 24, 2023 09:42
search api of justwatch.com
//run on console on https://www.justwatch.com/
//other usages are on https://github.com/Fredwuz/node-justwatch-api etc.
var query = '진격의 거인';
var locale = 'ko_KR';
var endpoint = '/titles/'+locale+'/popular';
var url = 'https://apis.justwatch.com/content' + endpoint;
var params = {
fields: ['id', 'title', 'object_type', 'original_release_year', 'scoring', 'full_path', 'external_ids', 'original_title'],
@anemochore
anemochore / run_rom_in_GA_pages.js
Created January 16, 2023 00:44
run_rom_in_GA_pages.js
(async () => {
const selector = 'div#artifacts table a.Link--primary';
const romEl = await elementReady_(selector);
const romFilename = romEl.innerText;
const proxyPrefix = 'https://nightly.link/';
const orgUrl = document.URL; //ex: https://github.com/pdpdds/kingsvalley/actions/runs/3908859118
const newUrl = orgUrl.replace('https://github.com/', proxyPrefix) + '/' + romFilename + '.zip';
const webMSXPrefix = 'https://webmsx.org/?ROM=';
@anemochore
anemochore / untitled0.ipynb
Created August 11, 2022 07:32
Untitled0.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anemochore
anemochore / add_header.py
Last active February 28, 2022 07:52
위키독스 md를 docx로 (위키독스에서 책을 다운로드하면 개별 md 파일에 문서 제목이 사라지므로, 임의의 마크업과 제목을 추가해서 하나로 합친다)
# 1. rename mds to be ordered (use a tool like Advanced Renamer)
# 2. run this file to merge mds to one md
# 3. run pandoc to convert md to docx with my filter (increase_header_level.py)
# 4. in word, find ?#n headers and apply appropriate styles
# standalone preprocessor for md files from wikidocs
import os
Path = "./"
filelist = os.listdir(Path)
SPACE = 0.3 # em
[START, END] = [1, 7] # assuming positive integers
MID = round((END - START + 1)/2)
STR = ''.join(list(str(i) for i in range(START, END + 1)))
html = '<html><head><style>p {margin: 0;}</style></head><body>'
padding = 0
for i in range(START, END + 1):
html += '<p style="padding-left: ' + str(padding * SPACE) + 'em;">' + STR[padding:len(STR) - padding]
@anemochore
anemochore / @for a2.feq
Last active December 18, 2021 14:04
foobar flat eq for audioengine a2 based on frequency reponse by https://www.stereophile.com/content/audioengine-2-powered-loudspeaker-measurements
-9
-9
-9
-8
-7
-6
-4
-3
-2
-1
@anemochore
anemochore / es6-element-ready.js
Last active October 26, 2020 14:38 — forked from jwilson8767/es6-element-ready.js
Wait for an element to exist. ES6, Promise, MutationObserver
// MIT Licensed
// Author: jwilson8767
/**
* Waits for an element satisfying selector to exist, then resolves promise with the element.
* Useful for resolving race conditions.
*
* @param selector
* @returns {Promise}
*/
@anemochore
anemochore / waitForKeyElements.js
Created October 17, 2020 16:18 — forked from BrockA/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@anemochore
anemochore / asyncFetchForEs5
Created December 19, 2019 01:49
legacy pattern by me for async fetching multiple urls
(function() {
var inputUrls = ['https://same.origin.pages', ...]; //input
var result = []; //global var for output
getTextFromUrls(inputUrls);
function getTextFromUrls(urlArray) {
var urls = urlArray.slice();
asyncFetch(urls.pop());
function asyncFetch(url) {