Skip to content

Instantly share code, notes, and snippets.

View hustshawn's full-sized avatar
🎯
Focusing

Shawn Zhang hustshawn

🎯
Focusing
  • AWS
  • Hong Kong
View GitHub Profile
@hustshawn
hustshawn / rectangle.json
Created February 13, 2024 10:32
Rectangle Config File
{
"bundleId": "com.knollsoft.Rectangle",
"shortcuts": {
"maximizeHeight": {
"keyCode": 126,
"modifierFlags": 917504
},
"rightHalf": {
"keyCode": 124,
"modifierFlags": 1572864
@hustshawn
hustshawn / a_search_math_agent.py
Last active March 22, 2024 15:18
LangChain agent with Google Search and Math Capability
from langchain import hub
from langchain.agents import AgentExecutor, load_tools
from langchain.agents.format_scratchpad import format_log_to_str
from langchain.agents.output_parsers import ReActJsonSingleInputOutputParser
from langchain.tools.render import render_text_description
from langchain_community.llms.bedrock import Bedrock
from langchain_community.chat_models.bedrock import BedrockChat
import dotenv
dotenv.load_dotenv()
1. # create new .py file with code found below
2. # install ollama
3. # install model you want “ollama run mistral”
4. conda create -n autogen python=3.11
5. conda activate autogen
6. which python
7. python -m pip install pyautogen
7. ollama run mistral
8. ollama run codellama
9. # open new terminal
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: s3-express-pv
spec:
capacity:
storage: 100Gi # ignored, required
accessModes:
- ReadWriteMany # supported options: ReadWriteMany / ReadOnlyMany
@hustshawn
hustshawn / llamaindex-bedrock.ipynb
Last active November 29, 2023 07:42
llamaindex with bedrock
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hustshawn
hustshawn / daemonset-fargate-anti-affinity.yaml
Last active June 21, 2023 15:53
A Kyverno policy to mutate any daemonset to avoid trying to deploy to Fargate instances.
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: add-daemonset-fargate-anti-affinity
spec:
validationFailureAction: Enforce
background: false
rules:
- name: add-node-anti-affinity
match:
@hustshawn
hustshawn / gitconfig
Last active July 30, 2022 04:36
$HOME/. gitconfig
[user]
name = <username>
email = <email>
signingkey = <gpg-sign-key>
[core]
editor = vi
[init]
defaultBranch = main
[color]
ui = auto
@hustshawn
hustshawn / vagrant-vmware-tech-preview-apple-m1-pro.md
Created January 17, 2022 14:19 — forked from sbailliez/vagrant-vmware-tech-preview-apple-m1-pro.md
Vagrant and VMWare Tech Preview on Apple M1 Pro

Vagrant and VMWare Tech Preview on Apple M1 Pro

This document summarizes notes taken while to make the VMWare Tech preview work on Apple M1 Pro, it originated from discussions in hashicorp/vagrant-vmware-desktop#22

Installing Rosetta

First install Rosetta if not already done, this is needed to run x86 code:

@hustshawn
hustshawn / iterm2.md
Created November 3, 2021 05:58 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@hustshawn
hustshawn / rss-engineer-blogs
Created September 16, 2021 14:59 — forked from oiler/rss-engineer-blogs
RSS for Engineering Blogs
{
"https://blog.twitter.com/developer": "https://blog.twitter.com/api/blog.rss?name=developer",
"https://code.facebook.com/posts/": "https://code.facebook.com/posts/rss",
"http://blog.chromium.org/": "http://blog.chromium.org/feeds/posts/default",
"http://www.theguardian.com/info/developer-blog": "http://www.theguardian.com/info/developer-blog/rss",
"http://open.blogs.nytimes.com/": "http://open.blogs.nytimes.com/feed/",
"http://blog.apps.npr.org/": "http://blog.apps.npr.org/atom.xml",
"http://www.webperformancetoday.com/": "http://www.webperformancetoday.com/feed/",
"http://www.filamentgroup.com/lab/": "http://www.filamentgroup.com/lab/atom.xml",
"http://githubengineering.com/": "http://githubengineering.com/atom.xml",