Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am umutbasal on github.
  • I am umutbasal (https://keybase.io/umutbasal) on keybase.
  • I have a public key whose fingerprint is 4276 22EE 3828 33D9 3BD7 A632 8C5B A3BB C7B6 E0ED

To claim this, I am signing this object:

onabort
onafterprint
onbeforeprint
onbeforeunload
onblur
onchange
onclick
ondblclick
onclose
oncontextmenu
const http = require('http')
const port = 80
const fs = require('fs')
const requests = {data:[]};
const requestHandler = (request, response) => {
let data = []
request.on('data', chunk => {
data.push(chunk)
@umutbasal
umutbasal / article-saver.sh
Created September 12, 2021 13:22
Download links as readable texts
files=$(ls | grep "txt")
for file in $files;
do
links=$(cat ${file})
for link in $links;
do
folder=${file//\.txt/}
saveName=$(echo $link | sed -e 's/http.*\///g')
readable $link | w3m -T text/html -dump > "$folder/$saveName.txt"
echo "$folder/$saveName"
const axios = require('axios');
const api = axios.create({
baseURL: 'https://api.themoviedb.org/3/',
params: {
api_key: `${process.argv.slice(2)[0]}`,
}
});
const main = async () => {
const words = require('./words.json');
const countVowels = ([...word]) => word.filter(l => l.match(/[aeiou]/i)).length;
const all = words.filter(([...word]) => {
return word.length == [...new Set([...word])].length;
}).sort((a, b) => countVowels(b) - countVowels(a));
console.log("most vowels: ",
all[0]
const _with = (v) => eval(`({${Object.getOwnPropertyNames(eval(v)).join(',')}} = ${v});`)
_with("Math"), (
console.log(cos(PI))
)
function logFromTraversal(object, match_string) {
function* traverse(o, path = []) {
for (var i in o) {
const itemPath = path.concat(i);
yield [i, o[i], itemPath, o];
if (o[i] !== null && typeof (o[i]) == "object") {
yield* traverse(o[i], itemPath);
}
}
}
import { serve } from "https://deno.land/[email protected]/http/server.ts";
interface ERequest extends Request {
params: any;
}
function routes(req: ERequest): Response {
const handlers = [
{
pattern: new URLPattern({ pathname: "/books" }),
let storage = {};
let get = function (key) {
return storage[key];
}
let put = function (key, value) {
storage[key] = value;
}