Skip to content

Instantly share code, notes, and snippets.

View boris1993's full-sized avatar
:shipit:
Code hard, die hard.

Boris Zhao boris1993

:shipit:
Code hard, die hard.
View GitHub Profile
// ==UserScript==
// @name 去掉力扣中国的跳转提示
// @namespace https://gist.github.com/boris1993/90df248d9bfca334f9aa6a94f16119a7
// @version 2023-12-25
// @description 去掉LeetCode国际版顶端的力扣中国的跳转提示
// @author boris1993
// @license WTFPL
// @match https://leetcode.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=leetcode.com
// @grant none
@boris1993
boris1993 / always-leetcode-com.js
Last active December 25, 2023 14:39
在访问leetcode.cn时自动跳转到leetcode.com
// ==UserScript==
// @name 自动跳转到leetcode.com
// @namespace https://gist.github.com/boris1993/5eabcb8d10fcd7fc52cf0dbdd0a7a41b
// @version 2023-12-25
// @description 在访问leetcode.cn时自动跳转到leetcode.com
// @author boris1993
// @license WTFPL
// @match https://leetcode.cn/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=leetcode.cn
// @grant none
# First, you must get the previous commit sha, the one before the forced push:
## Hit through terminal
curl -u <username> https://api.github.com/repos/:owner/:repo/events
# Then you can create a branch from this sha:
## Hit through terminal
curl -u <github-username> -X POST -d '{"ref":"refs/heads/<new-branch-name>", "sha":"<sha-from-step-1>"}' https://api.github.com/repos/:owner/:repo/git/refs
@boris1993
boris1993 / select_update.sql
Created December 9, 2019 03:35
Select update in MySQL
UPDATE users AS target, users AS source
SET target.name_one = source.name_colX
WHERE target.user_id = source.user_id

Keybase proof

I hereby claim:

  • I am boris1993 on github.
  • I am boris1993 (https://keybase.io/boris1993) on keybase.
  • I have a public key whose fingerprint is AB78 61CE 5606 FA9D 608B AF3F 22F4 4CB1 BAE2 CD9A

To claim this, I am signing this object:

@boris1993
boris1993 / .vimrc
Last active January 13, 2023 11:10
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin()
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
call plug#end()
@boris1993
boris1993 / CorsFilter.java
Created October 22, 2018 07:34
Handle HTTP OPTION method in filter
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest servletRequest = (HttpServletRequest) request;
if (servletRequest.getMethod().equals(HttpMethod.OPTIONS.toString())) {
((HttpServletResponse) response).addHeader("Access-Control-Allow-Origin", "*");
((HttpServletResponse) response).addHeader("Access-Control-Allow-Methods","GET, OPTIONS, HEAD, PUT, POST");
((HttpServletResponse) response).addHeader("Access-Control-Allow-Headers", ((HttpServletRequest) request).getHeader("Access-Control-Request-Headers"));
((HttpServletResponse) response).addHeader("Access-Control-Max-Age", "1800");
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
@boris1993
boris1993 / JedisFactory.java
Last active September 21, 2018 03:44
JedisFactory
/**
* This factory generates Jedis connection instances from a Jedis connection pool. <br>
* You can put your configurations in <code>redis.properties</code>, which accepts following properties:
* <ul>
* <li><code>redis.host</code> - Hostname or IP address to the Redis host. Default value is 127.0.0.1. </li>
* <li>(Optional) <code>redis.port</code> - Port of the Redis server. Default value is 6379. </li>
* <li>(Optional) <code>redis.timeout</code> - Connection timeout in seconds. Default value is 60. </li>
* <li>(Optional) <code>redis.auth</code> - Password for this Redis server. Default value is null. </li>
* </ul>
*
@boris1993
boris1993 / howto.md
Created May 30, 2018 06:12 — forked from adamcharnock/howto.md
Kubernetes install on Ubuntu 17.10 via kubeadm

Kubernetes install on Ubuntu 17.10 via kubeadm

Initial setup

apt-get update
apt-get upgrade
apt-get install curl

# Check VXLAN exists
@boris1993
boris1993 / .gitconfig
Last active November 7, 2019 09:45
global .gitignore
[core]
excludesfile = ~/.gitignore_global