Skip to content

Instantly share code, notes, and snippets.

View qeesung's full-sized avatar
🤡
[object object]

秦世成 qeesung

🤡
[object object]
View GitHub Profile
@magicdude4eva
magicdude4eva / zsh-syntax-highlighting paste performance improvement
Last active April 19, 2024 14:03
zsh-syntax-highlighting paste performance improvement
Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
@ljjjustin
ljjjustin / election.sql
Last active April 1, 2024 08:29
leader election using mysql
create table election (
id int(10) unsigned not null auto_increment,
name varchar(128) not null default '',
node varchar(128) not null default '',
last_seen timestamp not null default CURRENT_TIMESTAMP,
primary key (id),
unique key uniq_idx_name(name)
) engine=InnoDB;
@tpphu
tpphu / golang_job_queue.md
Created July 11, 2017 11:27 — forked from harlow/golang_job_queue.md
Job queues in Golang
@wavezhang
wavezhang / java_download.sh
Last active April 25, 2024 22:52
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@ankushs92
ankushs92 / SomeInterceptor.java
Last active April 12, 2024 12:23
How to get Path Variables inside a Spring interceptor.[This post assumes that you have an Interceptor registered and set up using XML or Java config]
public class SomeInterceptor extends HandlerInterceptorAdapter{
@Override
public boolean preHandle(final HttpServletRequest request,final HttpServletResponse response,final Object handler)
throws Exception
{
/*Assume the URI is user/{userId}/post/{postId} and our interceptor is registered for this URI.
* This map would then be a map of two elements,with keys 'userId' and 'postId'
*/
final Map<String, String> pathVariables = (Map<String, String>) request
.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
@pescobar
pescobar / build-git.sh
Created October 5, 2015 07:14
compile git with openssl instead of gnutls
#!/usr/bin/env bash
# Clear out all previous attempts
rm -rf "/tmp/source-git/"
# Get the dependencies for git, then get openssl
sudo apt-get install build-essential fakeroot dpkg-dev -y
sudo apt-get build-dep git -y
sudo apt-get install libcurl4-openssl-dev -y
mkdir -p "/tmp/source-git/"
@arturmkrtchyan
arturmkrtchyan / ObjectHeader32.txt
Last active April 8, 2024 02:03
Java Object Header
|----------------------------------------------------------------------------------------|--------------------|
| Object Header (64 bits) | State |
|-------------------------------------------------------|--------------------------------|--------------------|
| Mark Word (32 bits) | Klass Word (32 bits) | |
|-------------------------------------------------------|--------------------------------|--------------------|
| identity_hashcode:25 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Normal |
|-------------------------------------------------------|--------------------------------|--------------------|
| thread:23 | epoch:2 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Biased |
|-------------------------------------------------------|--------------------------------|--------------------|
|
@hgomez
hgomez / download-java8.sh
Created March 19, 2014 20:39
wget to download Java 8
wget --continue --no-check-certificate -O jdk-8-linux-x64.tar.gz --header Cookie: oraclelicense=a http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-x64.tar.gz