Skip to content

Instantly share code, notes, and snippets.

import os
from PIL import Image
files = os.listdir('.')
files = filter(lambda x: not x.endswith('.py') and not x.startswith('ex_'), files)
sizes = set()
min_size = 600
for file in files:
im = Image.open(file)
if im.size[0] > im.size[1]:
@kkeybbs
kkeybbs / chrome_flags.updated.js
Last active February 5, 2024 07:47
Backup chrome flags to json and restore the backup on another machine.
// 2022-04-03, tested with Chrome 99.0.4844.84 on MacBook Pro m1
/*
Open chrome://flags/
F12 open developer console, swtich to tab "Console"
Paste below codes
- input backup() to download flags backup file
- input restore() to select one backup to restore
*/
function saveFile(filename, data) {
@kkeybbs
kkeybbs / ngx_ws.conf
Created April 11, 2017 00:22
nginx websocket proxy
location /publish/dev/app/ws {
proxy_pass http://test:80;
# include conf.d/ws.txt;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass_request_headers on;
proxy_pass_header Server;
real_ip_header X-Real-IP;
@kkeybbs
kkeybbs / ngx_proxy.conf
Last active April 11, 2017 00:18
nginx reverse proxy
location /test/ {
proxy_pass http://test:9000;
# include conf.d/proxy.txt;
proxy_redirect off;
proxy_pass_request_headers on;
proxy_pass_header Server;
real_ip_header X-Real-IP;
# proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Scheme $scheme;