Skip to content

Instantly share code, notes, and snippets.

@fnky
fnky / ANSI.md
Last active May 6, 2024 16:06
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@pachacamac
pachacamac / clap.html
Last active April 26, 2022 19:22
Clap Detection in JS
<html>
<head>
<title>AudioPlayground</title>
<style>* {box-sizing: border-box;}</style>
</head>
<body>
<h3>AudioPlayground</h3>
<p>If you're happy and you know it, clap your hands!</p>
<script>
var Recording = function(cb){
@macik
macik / convBase.php
Created February 11, 2013 22:19
Convert an arbitrarily large number from any base to any base.
<?php
/*
Convert an arbitrarily large number from any base to any base.
string convBase(string $numberInput, string $fromBaseInput, string $toBaseInput)
$numberInput number to convert as a string
$fromBaseInput base of the number to convert as a string
$toBaseInput base the number should be converted to as a string
examples for $fromBaseInput and $toBaseInput
package socket.proxy;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousChannelGroup;
import java.nio.channels.AsynchronousServerSocketChannel;
import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.CompletionHandler;
import java.util.Queue;
@gunderwonder
gunderwonder / xbase.php
Created August 22, 2010 11:42
Base-encoding/decoding with arbitrary radix.
<?php
/**
* Base-encoding/decoding with arbitrary radix.
* @see http://stackoverflow.com/questions/1119722/base-62-conversion-in-python#answer-1119769
*/
define('BASE_64_ALPHABET', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
function xbase_encode($number, $alphabet = BASE_64_ALPHABET) {
if ($number == 0)
return $alphabet[0];