Skip to content

Instantly share code, notes, and snippets.

@nashid
nashid / install-nvm-zsh.txt
Created December 1, 2023 05:09 — forked from mike-casas/install-nvm-zsh.txt
install nvm on mac with zsh shell
After install zsh
- brew update
- brew install nvm
- mkdir ~/.nvm
after in your ~/.zshrc or in .bash_profile if your use bash shell:
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
@nashid
nashid / GPT4all-langchain-demo.ipynb
Created June 19, 2023 18:06 — forked from psychemedia/GPT4all-langchain-demo.ipynb
Example of running GPT4all local LLM via langchain in a Jupyter notebook (Python)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nashid
nashid / config.ts
Created July 23, 2022 23:08 — forked from AmazingTurtle/config.ts
openai client
export const DEFAULT_ENGINE = 'davinci';
export const ENGINE_LIST = ['ada', 'babbage', 'curie', 'davinci', 'davinci-instruct-beta', 'curie-instruct-beta'];
export const ORIGIN = 'https://api.openai.com';
export const DEFAULT_API_VERSION = 'v1';
export const DEFAULT_OPEN_AI_URL = `${ORIGIN}/${DEFAULT_API_VERSION}`;
@nashid
nashid / dgl-transformer.py
Created March 12, 2022 00:50 — forked from yzh119/dgl-transformer.py
Efficient Sparse Transformer implementation with DGL's builtin operators
import dgl
import dgl.ops as ops
import numpy as np
import torch as th
import torch.nn as nn
class FFN(nn.Module):
def __init__(self, d_feat, d_ffn, dropout=0.1):
super().__init__()
self.linear_0 = nn.Linear(d_feat, d_ffn)
@nashid
nashid / dgl-transformer.py
Created March 12, 2022 00:50 — forked from yzh119/dgl-transformer.py
Efficient Sparse Transformer implementation with DGL's builtin operators
import dgl
import dgl.ops as ops
import numpy as np
import torch as th
import torch.nn as nn
class FFN(nn.Module):
def __init__(self, d_feat, d_ffn, dropout=0.1):
super().__init__()
self.linear_0 = nn.Linear(d_feat, d_ffn)
@nashid
nashid / gist:5dbac9896e5c5c212c561659a4cfa010
Created March 11, 2022 07:03 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@nashid
nashid / punctuation.js
Created February 21, 2022 23:48 — forked from davidjrice/punctuation.js
List of punctuation characters
var PUNCTUATION = "" +
"’'" + // apostrophe
"()[]{}<>" + // brackets
":" + // colon
"," + // comma
"‒–—―" + // dashes
"…" + // ellipsis
"!" + // exclamation mark
"." + // full stop/period
"«»" + // guillemets
@nashid
nashid / PBS_sample.sh
Created January 10, 2022 22:53 — forked from mathsam/PBS_sample.sh
Sample PBS script
# Sample PBS job script
#
# Copy this script, customize it and then submit it with the ``qsub''
# command. For example:
#
# cp pbs-template.sh myjob-pbs.sh
# {emacs|vi} myjob-pbs.sh
# qsub myjob-pbs.sh
#
# PBS directives are fully documented in the ``qsub'' man page. Directives
@nashid
nashid / .md
Created September 23, 2021 17:02 — forked from rahulrajaram/.md
Python: Write to a file from multiple threads

I recently came across the need to spawn multiple threads, each of which needs to write to the same file. Since the file will experience contention from multiple resources, we need to guarantee thread-safety.

NOTE: The following examples work with Python 3.x. To execute the following programs using Python 2.7, please replace threading.get_ident() with thread.get_ident(). As a result, you would need to import thread and not threading.

  1. (The following example will take a very long time). It will create 200 threads, each of which will wait until a global lock is available for acquisition.
# threading_lock.py
import threading
@nashid
nashid / tmux_vs_screen.md
Created July 15, 2021 20:06 — forked from P7h/tmux_vs_screen.md
tmux vs screen commands

tmux vs. screen commands


Action tmux screen
start a new session tmux
tmux new
tmux new-session
screen
start a new session with a name tmux new -s name screen -S name
re-attach a detached session tmux attach
tmux attach-session
screen -r
re-attach a detached session with a name tmux attach -t name
tmux a -t name
screen -r name
re-attach an attached session (detaching it from elsewhere) tmux attach -dtmux attach-session -d screen -dr