Skip to content

Instantly share code, notes, and snippets.

View jcxia43's full-sized avatar
🚢
shipping

Junchen Xia jcxia43

🚢
shipping
View GitHub Profile
@jcxia43
jcxia43 / monaco-editor-for-function-call.js
Last active February 4, 2024 15:09
Add the OpenAI function call schema validation to monaco-editor
// OpenAI function call guide: https://platform.openai.com/docs/guides/gpt/function-calling
// JSON Schema reference: https://json-schema.org/understanding-json-schema/
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
validate: true,
schemas: [
{
uri: "http://myserver/foo-schema.json",
fileMatch: ["*"],
schema: {

Keybase proof

I hereby claim:

  • I am jcxia43 on github.
  • I am jcxia (https://keybase.io/jcxia) on keybase.
  • I have a public key whose fingerprint is 3670 A92C 259D 92F4 DFF5 5227 06DD 5BDA 6ECD F1B9

To claim this, I am signing this object:

@jcxia43
jcxia43 / pr
Last active December 22, 2016 13:03
Easily create GitHub PR in console
#!/usr/bin/env ruby
repo = `git remote show origin -n | grep h.URL | sed 's/.*://;s/.git$//'`.strip
branch = `git rev-parse --abbrev-ref HEAD`
`open https://www.github.com/#{repo}/compare/#{ARGV[0]}...#{branch}`
#!/bin/sh
SCRIPT="#!/bin/sh
if [ \${1} == \"--help\" ]; then
/usr/local/sublime_text_3/sublime_text --help
else
/usr/local/sublime_text_3/sublime_text \$@ > /dev/null 2>&1 &
fi"
curl -L "http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3047_x64.tar.bz2" -o "/tmp/sublime_text_3.tar.bz2"
cd /tmp
@jcxia43
jcxia43 / surge_main.conf
Created October 26, 2015 05:08 — forked from jason5ng32/surge.conf
Surge Configs
// DON'T FORGET TO IMPORT proxy.conf TOO
[General]
loglevel = notify
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24
// DNS OVERRIDE, REMOVE # IF YOU NEED
# dns-server = 223.6.6.6,223.5.5.5,114.114.114.114,114.114.115.115
@jcxia43
jcxia43 / simplecrawler.py
Created April 26, 2012 11:34
Simple web crawler
import urllib
#this is just a very simple web crawler, can not actually do
#what a real web crawler do :)
#get the next link on the page,here page is the content of
#the HTML text, also a string
def get_next_link(page):
start_pos = page.find("<a href=")
if start_pos == -1:
@jcxia43
jcxia43 / tmux.conf
Created October 1, 2015 15:20 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@jcxia43
jcxia43 / css_resources.md
Last active August 29, 2015 14:17 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@jcxia43
jcxia43 / python_resources.md
Last active August 29, 2015 14:17 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@jcxia43
jcxia43 / rails_resources.md
Last active August 29, 2015 14:17 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h