This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <stdlib.h> | |
#include <stdio.h> | |
const char month_name[12][10] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; | |
size_t BUFSIZE = 10; | |
char* iso2eng(char* iso_str) { | |
char* result; | |
int num[3]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name YouTube disable polymer | |
// @namespace https://zackguard.com/ | |
// @version 0.0.1 | |
// @description Disable Polymer on all YouTube pages | |
// @author Zack Guard | |
// @match https://www.youtube.com/* | |
// @run-at document-start | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const flatten = list => { | |
if (!list.length) return []; | |
else { | |
const x = list[0]; | |
if (Array.isArray(x)) return flatten([...x]).concat(flatten(list.slice(1))); | |
else return [x].concat(flatten(list.slice(1))); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Z = 1.65; // z_a/2 (a = 0.95) | |
const Z2 = Math.pow(Z, 2); | |
const w = (p, n) => (p + Z2 / (2 * n) - Z * Math.sqrt((p * (1 - p) + Z2 / (4 * n)) / n)) / (1 + Z2 / n); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isDarkMode = () => { | |
return window.matchMedia("(prefers-color-scheme: dark)").matches; | |
}; | |
const onThemeChange = (function() { | |
let listeners = []; | |
let mm = window.matchMedia("(prefers-color-scheme: dark)"); | |
mm.addEventListener("change", e => { | |
for (let listener of listeners) { | |
listener(e.matches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create an element with supplied attributes and contents and return it | |
* @param {string} tagName | |
* @param {Object} attributes | |
* @param {string} attributes._text | |
* @param {string} attributes._html | |
* @param {Object<string, string>} attributes.style | |
* @param {Node[]} attributes._children | |
* @param {string} attributes.* | |
* @returns {HTMLElement} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* font */ | |
body, body.non_osx { | |
font-family: "SF Pro Text", "Noto Sans CJK TC", sans-serif; | |
} | |
/* theming */ | |
html { | |
--color-background: #ffffff; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[buildPlans.iosevka-custom] | |
family = "Iosevka Custom" | |
design = [ | |
"ss09", | |
"cv01", "cv13", "cv24", "cv39", "cv44", "cv49", | |
"calt-center-ops", "calt-arrow", "calt-html-comment", "calt-trig", "calt-llgg", "calt-eqeq", "calt-ineq", "calt-plusplus", "calt-colons" # `calt' minus "exeq" | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn is-prime? [n] | |
(reduce (fn [p x] | |
(if (== 0 (mod n x)) | |
(reduced false) | |
p)) | |
true | |
(range (int (/ n 2)) 1 -1))) | |
(println (take 100 (filter is-prime? (iterate inc 2)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def min(nums) | |
min = nums[0] | |
min_i = 0 | |
nums.each_with_index do |n, i| | |
if n < min | |
min = n | |
min_i = i | |
end | |
end | |
[min, min_i] |