Skip to content

Instantly share code, notes, and snippets.

View DC3's full-sized avatar

Dee Cheung DC3

View GitHub Profile
@DC3
DC3 / termux-pacman-glibc-setup.sh
Created October 26, 2024 06:26 — forked from CodeIter/termux-pacman-glibc-setup.sh
Setup `glibc-runner` with pacman on Termux and install Deno.JS and Bun.JS .
#!/usr/bin/env -S bash -xeuo pipefail
set -xeuo pipefail
pkg install pacman patchelf \
which time ldd tree
echo
echo
@DC3
DC3 / WebGL-WebGPU-frameworks-libraries.md
Created September 7, 2024 14:33 — forked from dmnsgn/WebGL-WebGPU-frameworks-libraries.md
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub
@DC3
DC3 / 1_vue2-zustand.md
Created August 1, 2024 18:36 — forked from Zikoat/1_vue2-zustand.md
vue2-zustand

How to use Zustand with Vue 2

💻 Check out this Codesandbox demo: Vue 2 Playground

ℹ️ This approach works for Vue 2.6 and above.

🔍 Tiny: Just 10 lines of source code, no dependencies.

✨ The same Zustand store can be used with different libraries, such as Vue, React, or Svelte.

@DC3
DC3 / React Native.md
Created November 26, 2023 07:37 — forked from insertish/React Native.md
Configure React Native with Typescript, Vite.js for react-native-web and Storybook.
/**
* Format a date like YYYY-MM-DD.
*
* @param {string} template
* @param {Date=} [date]
* @return {string}
* @license MIT
*/
function formatDate(template, date) {
var specs = 'YYYY:MM:DD:HH:mm:ss'.split(':');
@DC3
DC3 / curl-crawler.sh
Created November 4, 2021 22:32 — forked from oliveratgithub/curl-crawler.sh
Unix Shell-Script to crawl a list of website URLs using curl
#!/bin/sh
timezone="Europe/Zurich"
# List of valid timezones: wikipedia.org/wiki/List_of_tz_database_time_zones
script="${0##*/}"
rootdir=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)
logfile="$script.log"
log="$rootdir/$logfile"
now=$(TZ=":$timezone" date)
# Uncomment 'mailto=' (remove #) to enable emailing the log upon completion
#mailto="[email protected]"
@DC3
DC3 / browser_history.md
Created June 30, 2020 08:01 — forked from dropmeaword/browser_history.md
Playing around with Chrome's history

Browser histories

Unless you are using Safari on OSX, most browsers will have some kind of free plugin that you can use to export the browser's history. So that's probably the easiest way. The harder way, which seems to be what Safari wants is a bit more hacky but it will also work for other browsers. Turns out that most of them, including Safari, have their history saved in some kind of sqlite database file somewhere in your home directory.

The OSX Finder cheats a little bit and doesn't show us all the files that actually exist on our drive. It tries to protect us from ourselves by hiding some system and application-specific files. You can work around this by either using the terminal (my preferred method) or by using the Cmd+Shft+G in Finder.

Finder

Once you locate the file containing the browser's history, copy it to make a backup just in case we screw up.

@DC3
DC3 / id.coffee
Created June 22, 2020 09:42 — forked from zhuangya/id.coffee
ID card verify
verify = (idcard) ->
factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
mask = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2]
idcard[idcard.length - 1] is mask[((x * factor[i] for x, i in idcard[0...idcard.length - 1]).reduce (x, y) -> x + y) % mask.length].toString()
@DC3
DC3 / extend-array.js
Created September 18, 2017 03:36 — forked from Gozala/extend-array.js
Array subclass ES5
// No need to sub class Array if what you need is just an extended
// array. Example below illustrates the way to extend Array.
function SubArray() {
return Object.defineProperties(Array.prototype.slice.call(arguments), SubArrayDescriptor)
}
SubArray.prototype = Array.prototype
var SubArrayDescriptor =
{ constructor: { value: SubArray }
, last: { value: function last() {
@DC3
DC3 / Makefile
Last active August 29, 2015 14:25 — forked from mattmccray/Makefile
Simple comparison of several compile-to-javascript languages, including: CoffeeScript, Dart, Haxe, and TypeScript.
.PHONY: compile
time=/usr/bin/time
compile: dart typescript coffeescript haxe jsx
dart:
$(time) dart2js -ooutput/dart.js source/simple.dart
typescript: