Skip to content

Instantly share code, notes, and snippets.

View martin-mok's full-sized avatar
🏠
Working from home

Martin martin-mok

🏠
Working from home
  • Hong Kong
View GitHub Profile
@rain-1
rain-1 / LLM.md
Last active July 18, 2024 22:37
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@Preethi-Dev
Preethi-Dev / git__stash__commands.md
Created March 31, 2022 15:19
Cheat sheet for git stash commands

Stash the changes

  1. git stash
  2. git stash save

Stash the untracked files

  1. git stash --include-untracked
  2. git stash -u

List the stashes

  1. git stash list

show the latest stash

  1. git stash show
@samlaf
samlaf / transfer-vs-send-vs-call.sol
Last active March 11, 2022 21:07
Sending Ether (transfer, send, call)
// In https://solidity-by-example.org/sending-ether/
// They say: call in combination with re-entrancy guard is the recommended method to use after December 2019.
// (see https://consensys.github.io/smart-contract-best-practices/recommendations/#dont-use-transfer-or-send for an explanation)
// and compare the gas fees of the 3 methods:
// transfer (2300 gas, throws error)
// send (2300 gas, returns bool)
// call (forward all gas or set gas, returns bool)
// I tested all 3 methods, by sending 10 eth to a contract and then withdrawing using these functions:
@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active July 24, 2024 12:24
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@martin-mok
martin-mok / c++_cheat-sheet.md
Created June 9, 2020 18:56 — forked from rubienr/c++_cheat-sheet.md
C++ Cheat Sheet
@martin-mok
martin-mok / nativeJavaScript.js
Created January 6, 2020 22:49 — forked from alexhawkins/nativeJavaScript.js
Implementation of Native JavaScript Methods (forEach, Map, Filter, Reduce, Every, Some)
'use strict';
/*****************NATIVE forEACH*********************/
Array.prototype.myEach = function(callback) {
for (var i = 0; i < this.length; i++)
callback(this[i], i, this);
};
//tests
@acutmore
acutmore / README.md
Last active January 21, 2024 20:30
Emulating a 4-Bit Virtual Machine in (TypeScript\JavaScript) (just Types no Script)

A compile-time 4-Bit Virtual Machine implemented in TypeScript's type system. Capable of running a sample 'FizzBuzz' program.

Syntax emits zero JavaScript.

type RESULT = VM<
  [
    ["push", N_1],         // 1
    ["push", False],       // 2
 ["peek", _], // 3
@martin-mok
martin-mok / millisecondsToHHmmss.java
Last active January 13, 2020 23:51
function to convert milliseconds to HHmmss format
/**
* return HH:mm:ss format
*
* @param milliseconds time in milliseconds
* @return the string time format with HH:mm:ss
* @throws ParseException
*/
private static String getTimeFormat(long milliseconds) throws ParseException {
long totalsec = milliseconds / 1000;
long hourPart = totalsec / 3600;
@swyxio
swyxio / final submission.md
Last active April 22, 2023 19:17
Why React is Not Reactive - React Rally CFP

This is the CFP for my React Rally talk, which was eventually accepted and given here: https://www.youtube.com/watch?v=nyFHR0dDZo0.

If you are a first time speaker, my CFP advice for new speakers is here.

Final Submission: Why React is not Reactive

Functional-reactive libraries like RxJS make it easy to understand how data changes, giving us tools to declaratively handle events and manage state. But while our render methods react to state changes, React isn’t reactive. Instead, we write imperative event-handlers, and trip up on gotchas like async setState and race conditions. Why? In this talk we build a Reactive React to show the difference between the "push" and "pull" paradigms of data flow and understand why React chooses to manage Scheduling as a core Design Principle, enabling awesome features like async rendering and Suspense!

Theme: This talk is a deep dive into React's core design principle around scheduling. Instead of abstr