Skip to content

Instantly share code, notes, and snippets.

@miraris
miraris / smolJikan.js
Last active March 25, 2022 08:41
smol jikan request helper
// const fetch = require('node-fetch'); /* if in node.js env */
const buildParams = ps =>
Object.keys(ps)
.map(k => `${k}=${ps[k]}`)
.join("&");
const buildURL = (args, params) =>
"https://api.jikan.moe/v3" +
`/${args.filter(Boolean).join("/")}` +
@miraris
miraris / sharenix.md
Last active November 26, 2018 18:20
sharenix config for OwO

Append both services the Services array.

$ nvim ~/.sharenix.json

Upload

@miraris
miraris / order.js
Created November 23, 2018 17:39
order points in plane to form continuous lines
const distance = (p1, p2) => (p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2;
const findNearestIndex = (point, list) => {
let nearestDistSquared = Infinity;
let nearestIndex;
for (let i = 0; i < list.length; i++) {
const curPoint = list[i];
const distsq = distance(point, curPoint);
<?php
$iter = 500000;
$start = microtime(true);
$n = 0;
for ($c = 0; $c < 7 * $iter; $c++) {
$i = $c % 16;
if ($i === 0) {
$n += 0;
const cheerio = require('cheerio')
const rp = require('request-promise')
const baseURL = 'https://www1.gogoanime.sh'
/**
* Fetches the full GogoAnime anime list
* @returns {Array} An array of anime objects
*/
const fetchList = async () => {
@miraris
miraris / getProxy.js
Last active June 1, 2019 13:49
Simple ES6 function to get an array of proxy objects, ready to be plugged into axios
const got = require("got");
const regex = /(?<host>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\:?(?<port>[0-9]{1,5})?/;
const getProxy = () =>
got("http://spys.me/proxy.txt").then(({ body }) =>
body
.split("\n")
.filter(val => regex.test(val))
.map(val => {
@miraris
miraris / openpgp.txt
Created August 1, 2018 08:17
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:477163af13bcb2119c9a171a3c441a263db8e8f3]
@miraris
miraris / mal_genres.json
Created May 25, 2018 15:38
MAL genres mappings
[
{
"id": 1,
"name": "Action",
"created_at": "2018-05-25 00:56:45.876651",
"description": "Plays out mainly through a clash of physical forces. Frequently these stories have fast cuts, tough characters making quick decisions and usually a beautiful girl nearby. Anything quick and most likely a thin storyline."
},
{
"id": 2,
"name": "Adventure",
@miraris
miraris / validator.js
Last active June 1, 2018 11:56
A poor man’s Postgraphile args validator plugin implementation
/**
* The pagination args validator
* @param {number} opts
*/
function validator (opts) {
const options = opts || {}
const min = options.min || 1
const max = options.max || 100
return (args) => {

Keybase proof

I hereby claim:

  • I am miraris on github.
  • I am miraris (https://keybase.io/miraris) on keybase.
  • I have a public key ASDGUp4fAl9MNjaNbHKo-XUiZ78VbpOTfU4zt1D_YY_d0Qo

To claim this, I am signing this object: