Skip to content

Instantly share code, notes, and snippets.

View Anricx's full-sized avatar
🏠
Working from home

D.T. Anricx

🏠
Working from home
  • Chengdu, Sichua, China.
View GitHub Profile
@soulmachine
soulmachine / jwt-expiration.md
Last active June 19, 2025 15:38
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@voluntas
voluntas / sysctl.conf
Created October 14, 2017 13:07 — forked from techgaun/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
@exAspArk
exAspArk / curl.sh
Last active October 18, 2025 13:48
Test CORS with cURL
curl -I -X OPTIONS \
-H "Origin: http://EXAMPLE.COM" \
-H 'Access-Control-Request-Method: GET' \
http://EXAMPLE.COM/SOMETHING 2>&1 | grep 'Access-Control-Allow-Origin'
@dazraf
dazraf / 0. Dynamic Template
Created April 2, 2014 16:05
Aggregation of nested arrays using dynamic templates for nested types
curl -XPUT "http://localhost:9200/_template/logstash" -d'
{
"template": "logstash-*",
"settings": {
"index.refresh_interval": "5s"
},
"mappings": {
"_default_": {
"dynamic_templates": [
{
@denji
denji / nginx-tuning.md
Last active October 24, 2025 16:02
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@zythum
zythum / gist:2848881
Created June 1, 2012 04:50
google收录的敏感词