Skip to content

Instantly share code, notes, and snippets.

View nyngwang's full-sized avatar
💭
I may be slow to respond.

nyngwang

💭
I may be slow to respond.
View GitHub Profile
@nyngwang
nyngwang / DOM3D.js
Created March 27, 2024 14:20 — forked from OrionReed/dom3d.js
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@nyngwang
nyngwang / one_layer_backward_pass.py
Created June 9, 2023 15:37 — forked from ksivaman/one_layer_backward_pass.py
One layer backward pass for feed forwards neural networks.
def one_layer_backward_pass(curr_grad, curr_weight, curr_bias, curr_out, prev_act, activation='R'):
#how many sample in previous activations?
num = prev_act.shape[1]
#find out what we are differentiating
if activation is 'R':
d_act_func = activations.d_relu
elif activation is 'S':
d_act_func = activations.d_sigmoid
@nyngwang
nyngwang / lua-snip-keymaps.lua
Created May 26, 2023 16:35 — forked from s1n7ax/lua-snip-keymaps.lua
LuaSnip keymaps written in lua
local ls = require('luasnip')
local M = {}
function M.expand_or_jump()
if ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end
@nyngwang
nyngwang / opt_as_hook.py
Created April 18, 2023 10:21 — forked from albanD/opt_as_hook.py
PyTorch optimizer as hook
import torch
from torch import nn
from torch.optim.sgd import sgd
import gc
import objgraph
import weakref
def all():
# Only a subset of the args you could have
def set_sgd_hook(mod, p, lr, weight_decay, momentum):
@nyngwang
nyngwang / markdown-details-collapsible.md
Created September 15, 2022 06:42 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

How to

<details>
  <summary>Click me</summary>
  
  ### Heading
  1. Foo
  2. Bar
     * Baz
 * Qux
Lua 33 hrs 6 mins █████████████▎░░░░░░░ 63.4%
TypeScript 7 hrs 43 mins ███░░░░░░░░░░░░░░░░░░ 14.8%
Markdown 2 hrs 57 mins █▏░░░░░░░░░░░░░░░░░░░ 5.7%
JavaScript 2 hrs 41 mins █░░░░░░░░░░░░░░░░░░░░ 5.2%
Other 2 hrs 6 mins ▊░░░░░░░░░░░░░░░░░░░░ 4.0%
@nyngwang
nyngwang / README.md
Created December 16, 2021 08:06 — forked from steve-jansen/README.md
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
namespace OnlineStoreBackend
{
public interface IPersistenceManager
{
bool UsernameExists(string username);
void SaveAccount(string username, string password);
}
}