Skip to content

Instantly share code, notes, and snippets.

View nampdn's full-sized avatar
🌓
New creation in Christ!

Nam Pham nampdn

🌓
New creation in Christ!
  • Somewhere on Earth
View GitHub Profile
@mattiasarro
mattiasarro / rwkv.py
Last active May 27, 2024 09:17
RWKV MVP
# Taken from https://johanwind.github.io/2023/03/23/rwkv_details.html.
# I've added additional comments restructured it a tiny bit, which makes it clearer for me.
import numpy as np
from torch import load as torch_load # Only for loading the model weights
from tokenizers import Tokenizer
exp = np.exp
layer_norm = lambda x, w, b : (x - np.mean(x)) / np.std(x) * w + b
sigmoid = lambda x : 1/(1 + exp(-x))
@hynek
hynek / haproxy-ingress.hcl
Created January 29, 2021 06:28 — forked from mister2d/haproxy-ingress.hcl
nomad job for HAProxy ingress
job "ingress" {
region = "global"
datacenters = ["home"]
type = "service"
constraint {
attribute = "${meta.proxy_type}"
value = "internal"
}
@jeffreycastro
jeffreycastro / heroku_pg_to_sqlite3.txt
Last active September 12, 2022 13:18
Import Heroku Postgres to SQLite3 in your local Rails
### Disclaimer,
- datetime is not copied with the timezone difference. seems like the dates are saved in UTC so there will be difference with the datetime columns
---
in this guide,
postgres username = "jep"
postgres password = "jepjep"
@jsvd
jsvd / gen.sh
Created October 16, 2018 11:55
warning: do not use the certificates produced by this tool in production. This is for testing purposes only
# warning: do not use the certificates produced by this tool in production. This is for testing purposes only
# certificate authority
openssl genrsa -out RootCA.key 4096
openssl req -new -x509 -days 1826 -extensions v3_ca -key RootCA.key -out RootCA.crt
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in RootCA.key -out RootCA.key.pkcs8
# intermediate CA
openssl genrsa -out IntermediateCA.key 4096
@findmory
findmory / README.md
Last active April 5, 2019 21:09
Starting a new project with react-native init

As of 9/24/2018 here are the versions running and the steps to start a clean project

Check your versions: react-native init

React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
kubectl exec --namespace=manadr-dev -it $(kubectl get pod -l "service=mysql" --namespace=manadr-dev -o jsonpath='{.items[0].metadata.name}') -- bash
@niespodd
niespodd / package.json
Last active May 8, 2023 09:07
Making web3/bitcore-lib work with Angular 6-11 and >=11
{...
"scripts": {
"postinstall": "node patch.js",
...
}
}
@staltz
staltz / readme.ts
Created April 25, 2018 17:31
callbag-typescript-proof-of-concept
/**
* Callbag loves TypeScript
*
* Copy-paste this into http://www.typescriptlang.org/play/index.html
*/
// A Callbag dynamically receives input of type I
// and dynamically delivers output of type O
type Callbag<I, O> = {
(t: 0, d: Callbag<O, I>): void;
@hagemann
hagemann / slugify.js
Last active October 30, 2023 09:10
Slugify makes a string URI-friendly
function slugify(string) {
const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;'
const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w\-]+/g, '') // Remove all non-word characters
@shivamkr19
shivamkr19 / download-egghead-io-videos.md
Last active February 4, 2022 09:48
Download free egghead.io videos

Download free egghead.io videos

Download Egghead.io videos using Lynx Browser and youtube-dl. This method will only work for videos that do not require a pro account.

Prerequesits

You need a Unix/Linux box with Lynx console browser and Youtube-dl installed.