Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

知识管理咨询师 sheldonshen

🎯
Focusing
View GitHub Profile
@dongweiming
dongweiming / cn_participation.py
Last active September 5, 2019 15:57
Get chinese contributor
View cn_participation.py
# coding=utf-8
# Note:
# 1. 使用Redis缓存用户信息,减少重复调用
# 2. 只通过用户的location字段看是否包含beijing、shanghai、guangzhou、
# shenzhen、china这几个关键词判断是否是国人
from collections import defaultdict
import redis
import requests
USENAME = '<YOUR USERNSME>'
@Integralist
Integralist / Redis vs Memcache.md
Last active February 12, 2022 10:08
Redis vs Memcache
View Redis vs Memcache.md

When deciding between Memcached and Redis, here are a few questions to consider:

  • Is object caching your primary goal, for example to offload your database? If so, use Memcached.
  • Are you interested in as simple a caching model as possible? If so, use Memcached.
  • Are you planning on running large cache nodes, and require multithreaded performance with utilization of multiple cores? If so, use Memcached.
  • Do you want the ability to scale your cache horizontally as you grow? If so, use Memcached.
  • Does your app need to atomically increment or decrement counters? If so, use either Redis or Memcached.
  • Are you looking for more advanced data types, such as lists, hashes, and sets? If so, use Redis.
  • Does sorting and ranking datasets in memory help you, such as with leaderboards? If so, use Redis.
  • Are publish a
@magicznyleszek
magicznyleszek / css-selectors.md
Last active June 3, 2023 04:56
CSS Selectors Cheatsheet
View css-selectors.md

CSS Selectors Cheatsheet

Hi! If you see an error or something is missing (like :focus-within for few years :P) please let me know ❤️

Element selectors

Element -- selects all h2 elements on the page

h2 {
View search.php
<?
require("redis.php");
require("json.php");
$term = $_GET['term'];
$r = new Redis("127.0.0.1","6379");
$r->connect();
$items = $r->zrangebylex("kernel","[$term","[$term\xff",Array("LIMIT","0","10"));
@jeremyfelt
jeremyfelt / open-source-search-compare.md
Last active February 5, 2022 17:52
Comparing open source search solutions
View open-source-search-compare.md
@benjchristensen
benjchristensen / FuturesB.java
Last active May 24, 2023 03:56
FuturesB.java Example of using Futures for nested calls showing how it blocks inefficiently.
View FuturesB.java
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@benjchristensen
benjchristensen / FuturesA.java
Last active November 13, 2022 18:34
FuturesA.java Simple example of using Futures.
View FuturesA.java
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class FuturesA {
public static void run() throws Exception {
@paulmillr
paulmillr / active.md
Last active May 27, 2023 22:03
Most active GitHub users (by contributions). http://twitter.com/paulmillr
View active.md

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Tue, 06 Dec 2016 17:06:46 GMT till Wed, 06 Dec 2017 17:06:46 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 1000)