Skip to content

Instantly share code, notes, and snippets.

View desenmeng's full-sized avatar
🤡
LOL

Desen Meng desenmeng

🤡
LOL
View GitHub Profile
"""
NOTE: make sure to install:
pip install Pillow google-genai loguru
"""
from google import genai
from google.genai import types
from PIL import Image
from io import BytesIO
import os
@ninehills
ninehills / chatpdf-zh.ipynb
Last active April 23, 2025 10:17
ChatPDF-zh.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tiensonqin
tiensonqin / logseq-queries.md
Created December 5, 2022 04:44
Initial input for chatgpt
  • What are "Queries" in Logseq?
    • Queries are for asking questions from your knowledge base and the outside world.
      • How to write simple queries?
        • By using {{query }}, the format is something like this:
        {{query Something you're looking for}}
        
  • **Query Operators ** These three operators can be applied around any query filters.
    • and
@optimalisatie
optimalisatie / lazy-instant-render.js
Last active December 25, 2022 09:04
Image lazy loading with instant visibility of in-view images on page load (MutationObserver)
// Performance tests such as Google Lighthouse often complain about below the fold images while lazy loading
// techniques may introduce a flash effect for images on bigger screens
// This snippet shows a solution to instantly display images as if loaded using src="" while maintaining
// the lazy loading benefit on smaller screens.
// Tip: a second and potentially better technique is to rewrite lazy loaded images to regular src="" images in a Service Worker.
// this snippet depends on in-view (5kb)
// @link https://github.com/camwiegert/in-view/

How to install dlib v19.9 or newer (w/ python bindings) from github on macOS and Ubuntu

Pre-reqs:

  • Have Python 3 installed. On macOS, this could be installed from homebrew or even via standard Python 3.6 downloaded installer from https://www.python.org/download. On Linux, just use your package manager.
  • On macOS:
    • Install XCode from the Mac App Store (or install the XCode command line utils).
    • Have homebrew installed
  • On Linux:
@LiuJi-Jim
LiuJi-Jim / id-card.js
Created June 14, 2016 04:26
id-num gen
var factors = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
var tails = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']
var provinceMap = {
11: '北京',
12: '天津',
13: '河北',
14: '山西',
15: '内蒙古',
21: '辽宁',
22: '吉林',
@gaearon
gaearon / reducers.js
Last active December 11, 2020 14:56
How I'd do code splitting in Redux (pseudo code, not tested!)
import { combineReducers } from 'redux';
import users from './reducers/users';
import posts from './reducers/posts';
export default function createReducer(asyncReducers) {
return combineReducers({
users,
posts,
...asyncReducers
});
@kejun
kejun / gist:72112e5848f5e3921b0d
Created March 7, 2015 12:14
react + linear partition算法实现的图墙布局
var React = require('react');
var EventListener = require('react/lib/EventListener');
var partition = require('linear-partitioning');
var TileLayout = React.createClass({
getDefaultProps: function() {
return {
gutter: 0,
photos: []
}
@steve-jansen
steve-jansen / README.md
Last active December 13, 2024 23:29
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
@hydra35
hydra35 / nginx.conf
Last active May 14, 2021 03:51
to gray, for Ya'An, Si Chuan earthquake
# 1. Make sure you have nginx sub module compiled in
# nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module'
# 2. add two directives below at HTTP level
# nginx.conf
http {
# ......
sub_filter '</head>' '<style type="text/css">html{ filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */