Skip to content

Instantly share code, notes, and snippets.

View hellokaton's full-sized avatar
:shipit:
Focusing on work

見える hellokaton

:shipit:
Focusing on work
View GitHub Profile
@onlyeat3
onlyeat3 / A.java
Created August 16, 2017 04:52
获取lambda表达式的元信息
@FunctionalInterface
public interface A<T, R> extends Function<T, R>, Serializable {
}
@jonlabelle
jonlabelle / npm_vs_yarn_command_translation_cheatsheet.md
Last active April 11, 2024 15:26
npm vs yarn command translation cheat sheet
@hellokaton
hellokaton / git_cmd.md
Last active May 7, 2017 05:19
git常用命令

把本地的dev分支强制(-f)推送到远程master

git push origin dev:master -f

删除远程分支

@kashifrazzaqui
kashifrazzaqui / code_review_checklist.txt
Last active February 17, 2024 23:05
Code Review Checklist
- General
[ ] The code works
[ ] The code is easy to understand
[ ] Follows coding conventions
[ ] Names are simple and if possible short
[ ] Names are spelt correctly
[ ] Names contain units where applicable
[ ] Enums are used instead of int constants where applicable
[ ] There are no usages of 'magic numbers'
[ ] All variables are in the smallest scope possible
@tonymtz
tonymtz / gist:d75101d9bdf764c890ef
Last active December 29, 2023 00:40
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@hgfischer
hgfischer / benchmark+go+nginx.md
Last active April 11, 2024 22:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@ekho
ekho / pg_random_int_array.sql
Last active February 9, 2024 13:47
Postgresql function for generating random integer array
CREATE OR REPLACE FUNCTION random_int_array(dim integer, min integer, max integer) RETURNS integer[] AS $BODY$
begin
return (select array_agg(round(random() * (max - min)) + min) from generate_series (0, dim));
end
$BODY$ LANGUAGE plpgsql;
-- usage example
select random_int_array(15, 6, 40);
-- return example
@paulmillr
paulmillr / active.md
Last active April 23, 2024 17:32
Most active GitHub users (by contributions). http://twitter.com/paulmillr

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 Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

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)
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
/**
* 一种本地缓存的无锁实现思路
* 适用场景:预先知道的需要缓存的一批数据,比如卖家品牌授权,馆信息,达人信息
* 数据更新不太频繁,定时更新或者更新由自己手动控制
*/
public abstract class AbstractLocalCache<K, V> {