Skip to content

Instantly share code, notes, and snippets.

@inflammable
inflammable / base58.js
Created June 14, 2012 09:50
Base58 (and other) Encoding and Decoding in Javascript
/*
* base58.js
* - encodes integers to and decodes from a base58 (or your own) base58 alphabet
* - based on Flickr's url shortening
*
* usage:
* base58.encode(integer);
* base58.decode(string);
*
* (c) 2012 inflammable/raromachine
@gp187
gp187 / currencies.json
Created February 9, 2017 12:32
All currencies in JSON -- Array of Objects
[{
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
}, {
"symbol": "CA$",
@maxtruxa
maxtruxa / Makefile
Last active May 12, 2024 21:49
Generic makefile for C/C++ with automatic dependency generation, support for deep source file hierarchies and custom intermediate directories.
# output binary
BIN := test
# source files
SRCS := \
test.cpp
# files included in the tarball generated by 'make dist' (e.g. add LICENSE file)
DISTFILES := $(BIN)
@wuchengwei
wuchengwei / dataURL to blob and blob to dataURL
Last active May 12, 2024 21:49
dataURL to blob and blob to dataURL
//**dataURL to blob**
function dataURLtoBlob(dataurl) {
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
while(n--){
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], {type:mime});
}
@Ayke
Ayke / cuda-wsl2-ubuntu.md
Last active May 12, 2024 21:49
Everything About CUDA in WSL2 Ubuntu

Prerequisites, i.e. the most important things

  1. Time of writing: Jan 18, 2023. The following assume you're trying to install CUDA on WSL2 Ubuntu.

  2. Check support matrix first before you install any version of CUDA, because chances are the latest CUDA does not have cuDNN support yet, then you'll have to re-install older version if you found out later.

    https://docs.nvidia.com/deeplearning/cudnn/support-matrix/index.html#cudnn-cuda-hardware-versions

    At the time of writing, the latest cuDNN version is 8.7 and it supports CUDA 11.8.

  3. Windows 10 must be build 20145 or later.

@aluissp
aluissp / tailwind.config.js
Created February 12, 2023 20:45
Fade in animation in Tailwind CSS
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
theme: {
extend: {
animation: {
fade: 'fadeIn .5s ease-in-out',
},
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Scrollbar</title>
<style>
.scroll-box {
position: relative;
width: 300px; /* Adjust to fit your design */
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Scrollbar</title>
<style>
.scroll-box {
position: relative;
width: 300px; /* Adjust to fit your design */
@saxxie-dev
saxxie-dev / tiktok-blockout-helper.js
Created May 12, 2024 21:37
Simple script for blocking people on the tiktok web search page. Be careful when copy-pasting code from the internet!
// Grab csrf token to get around XSS controls.
const csrfToken = JSON.parse(__UNIVERSAL_DATA_FOR_REHYDRATION__.textContent).__DEFAULT_SCOPE__["webapp.app-context"].csrfToken;
// Eavesdrop on search requests and create mapping between userId and sec_uid
const userIdMapping = new Map();
const realFetch = fetch;
window.fetch = (url, ...vars) => {
return realFetch(url, ...vars).then(async (res) => {
if (url.toString().match(/search\/user\/full/)) {
// After getting new results, add block button to them

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?