Skip to content

Instantly share code, notes, and snippets.

@KaeruCT
KaeruCT / dokuwikifolder2markdown.js
Created August 7, 2023 13:23
nodejs script to convert a dokuwiki data folder to markdown files
const fs = require('fs');
const path = require('path');
const folderPath = './'; // Replace with the actual folder path
// Function to rename a file from .txt to .md and replace content
function renameAndReplace(filePath) {
const newFilePath = filePath.replace('.txt', '.md');
fs.renameSync(filePath, newFilePath);
@KaeruCT
KaeruCT / hackertyper.sh
Last active April 4, 2022 15:21
hackertyper.com on your bash shell
#!/bin/bash
if [ ! -r "$1" ]; then
echo "Please provide a valid file."
exit 0
fi
file="$(<$1)"
length="${#file}"
speed=4
char_count=0
@KaeruCT
KaeruCT / yt-js-api-example.html
Created May 23, 2014 19:36
Playing music in the background using the Youtube JS API
<!DOCTYPE html>
<html>
<body>
<div id="player" style="position: absolute; top: -9999px; left: -9999px;"></div>
<div id="info">loading...</div>
<script src="http://www.youtube.com/player_api"></script>
<script>
var info = document.getElementById('info');
function onYouTubePlayerAPIReady() {
var player = new YT.Player('player', {

Keybase proof

I hereby claim:

  • I am kaeruct on github.
  • I am kaeruct (https://keybase.io/kaeruct) on keybase.
  • I have a public key whose fingerprint is BF9E 3EFB 4677 898C F631 CB80 C6DA 1A18 34DE DE53

To claim this, I am signing this object:

@KaeruCT
KaeruCT / noise.py
Created January 8, 2014 19:33
./noise.py | aplay --channels=2 --rate=22500
#!/usr/bin/env python2
# ./noise.py | aplay --channels=2 --rate=22500
import sys
import math
import random
TEMPO=1000
def p(i):
(function (exports, undefined) {
var baseUrl,
resourceMap,
type;
exports.ub = {
init: function (options) {
baseUrl = options.baseUrl;
type = options.type;
resourceMap = options.resourceMap;
#!/usr/bin/php
<?php
class Gasm { private $code = []; private $pc = 0; private $code_start = 0; private $code_len = 0; private $vars = []; private $labels = []; private $stack = []; private $comparison = false; private function line_number() { return 1 + $this->code_start + $this->pc; } private function strip_comments($line) { return trim(preg_replace('%;(.*)$%m', '', $line)); } private function is_label ($line) { return substr($line, -1) === ':'; } private function parse_line($line) { return array_map('trim', preg_split('%\s%', $line, 2)); } private function parse_args($args) { return array_map('trim', preg_split('%,%', $args)); } private function eval_expression($exp) { $matches = []; $ops = [ '+' => function ($a, $b) {return $a + $b;}, '-' => function ($a, $b) {return $a - $b;}, '*' => function ($a, $b) {return $a * $b;}, '/' => function ($a, $b) {return $a / $b;}, '%' => function ($a, $b) {return $a % $b;}, ]; $literals = [ '\n' => "\n", '\t' => "\t" ]; $ifx = '/(\w+)\s*(['.preg_quote(implode('', array_ke
#!/usr/bin/php
<?php
if (empty($argv[1])) {
die("please specify a file\n");
}
function is_str($word) {
return preg_match('%^".*"$%', $word);
}
@KaeruCT
KaeruCT / .conkyrc
Created September 12, 2013 21:33
conky config
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_class conky-semi
own_window_argb_value 40
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
format_human_readable yes
double_buffer yes
background yes
package main
import (
"fmt"
"math/big"
)
func fibonacciCalculator() func(n int) *big.Int{
cache := map[int]*big.Int{
0: big.NewInt(0),