Skip to content

Instantly share code, notes, and snippets.

View scriptype's full-sized avatar
🍁

Mustafa Enes Ertarhanaci scriptype

🍁
View GitHub Profile
@jakelazaroff
jakelazaroff / rss2activitypub.js
Last active October 28, 2023 07:41
Publish the latest post in an RSS feed to an ActivityPub Starter Kit feed
import { XMLParser } from "fast-xml-parser";
import fetch from "node-fetch";
const RSS_URL = "https://jakelazaroff.com/rss.xml";
const ACTIVITYPUB_HOST = "https://shine-thunder-forgery.glitch.me";
const OUTBOX_URL = ACTIVITYPUB_HOST + "/test/outbox";
const CREATE_URL = ACTIVITYPUB_HOST + "/admin/create";
const ADMIN_USERNAME = "jake";
const ADMIN_PASSWORD = "test";
@munificent
munificent / generate.c
Last active May 14, 2024 05:30
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
@lhorie
lhorie / longest-keyword-sequence.md
Last active November 14, 2022 23:21
What's the longest keyword sequence in Javascript?
@v0lkan
v0lkan / evolution-of-a-fetch.js
Last active February 26, 2018 08:27
The Evolution of a Fetch
// Assume `dispatch` and `fetchFromNetwork` are defined elsewhere.
// ## 1. CPS With Nodebacks
// This is the old-school-style fetch. Mostly here for
// historical reasons.
//
// Yet, contrary to the arguments against using it,
// it‘s not that hard to maintain this code when you are
// careful and know what you are doing.
require 'faraday'
class PasswordCracker
ALPHABET = (('a'..'z').to_a + ('0'..'9').to_a).shuffle
SUBJECT = 'password'
def initialize(api)
@api = api
@password = ''
end
@csswizardry
csswizardry / README.md
Last active June 16, 2024 13:44
Vim without NERD tree or CtrlP

Vim without NERD tree or CtrlP

I used to use NERD tree for quite a while, then switched to CtrlP for something a little more lightweight. My setup now includes zero file browser or tree view, and instead uses native Vim fuzzy search and auto-directory switching.

Fuzzy Search

There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*, e.g.:

:vs **/*<partial file name><Tab>
@v0lkan
v0lkan / silence.sh
Last active July 17, 2024 10:22
How to Have a Silent and High-Performing Western Digital MyCloud Mirror
#
# Needless to say, I (Volkan Ozcelik) take no responsibility, whatsoever,
# about what will happen to your NAS when you try these.
# When did it to mine, I observed *ENORMOUS* performance gain and a zen-like silence.
#
# +----------------------------------------------------------+
# | WHAT YOU ARE GOING TO DO CAN LIKELY VOID YOUR WARRANTY |
# | SO PROCEED WITH CAUTION |
# +----------------------------------------------------------+
#
@v0lkan
v0lkan / how-to-write.md
Last active December 24, 2020 15:15
How to Write

This is a copy of this presentation by Michael Covington

Why?

  • People who write are powerful.
  • In science, technology, or management, you influence people by writing things for them to read.
  • Clear writing leads to clear thinking.
  • You don’t know what you know until you try to express it.
  • If your writing is nonsense, maybe your thoughts are nonsense too!
@john-doherty
john-doherty / javascript-trim-svg-whitespace.js
Created October 21, 2016 13:39
Trim whitespace from SVG elements
function trimSvgWhitespace() {
// get all SVG objects in the DOM
var svgs = document.getElementsByTagName("svg");
// go through each one and add a viewbox that ensures all children are visible
for (var i=0, l=svgs.length; i<l; i++) {
var svg = svgs[i],
box = svg.getBBox(), // <- get the visual boundary required to view all children
@cedricbellet
cedricbellet / Bitwise AND
Last active September 19, 2016 19:25
Representation of the bitwise AND pattern
.