Skip to content

Instantly share code, notes, and snippets.

View Kuri-su's full-sized avatar
❄️
DeepIn && Focus

Kurisu_Amatist Kuri-su

❄️
DeepIn && Focus
View GitHub Profile
@shijinkui
shijinkui / basecommand_emacs
Created March 16, 2012 02:42
Emacs常用基本快捷键
/************************************/
基本命令
C-x C-f 打开/新建文件
C-x C-s 保存当前缓冲区
C-x C-w 当前缓冲区另存为
C-x C-v 关闭当前Buffer并打开新文件
C-x i 光标处插入文件
C-x b 切换Buffer
C-x C-b 显示Buffer列表
C-x k 关闭当前Buffer
@jboner
jboner / latency.txt
Last active May 3, 2024 01:00
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@dmitshur
dmitshur / gist:6927554
Last active September 17, 2023 07:35
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.

WARNING: This gist was created in 2013 and targets the legacy GOPATH mode. If you're reading this in 2021 or later, you're likely better served by reading https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.

$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@rxaviers
rxaviers / gist:7360908
Last active May 3, 2024 12:42
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@spidersea
spidersea / grep_awk_sed 多核利用
Created December 24, 2013 08:37
grep/awk/sed 多核利用
如何利用多核CPU来加速你的Linux命令 — awk, sed, bzip2, grep, wc等
你是否曾经有过要计算一个非常大的数据(几百GB)的需求?或在里面搜索,或其它操作——一些无法并行的操作。数据专家们,我是在对你们说。你可能有一个4核或更多核的CPU,但我们合适的工具,例如 grep, bzip2, wc, awk, sed等等,都是单线程的,只能使用一个CPU内核。
借用卡通人物Cartman的话,“如何我能使用这些内核”?
要想让Linux命令使用所有的CPU内核,我们需要用到GNU Parallel命令,它让我们所有的CPU内核在单机内做神奇的map-reduce操作,当然,这还要借助很少用到的–pipes 参数(也叫做–spreadstdin)。这样,你的负载就会平均分配到各CPU上,真的。
BZIP2
@chrisgillis
chrisgillis / ssl_smtp_example.go
Created April 16, 2014 14:48
Golang SSL SMTP Example
package main
import (
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"crypto/tls"
)
#!/usr/bin/perl
use 5.010;
use warnings;
use strict;
use Geo::IP;
use Parse::Syslog::Line qw( parse_syslog_line );
use Socket qw( getnameinfo NI_NUMERICHOST NI_NUMERICSERV );
use POSIX qw( strftime );
use AnyEvent;
use AnyEvent::Handle::UDP;
@ionauq
ionauq / PhpStorm Keymap
Last active June 22, 2021 02:42
PhpStorm快捷键
### Editing ###
`Ctrl + Space` 基本代码完成(任意类的,方法的或者变量的名称)
`Ctrl + Shift + Enter` 补全当前语句
`Ctrl + P` Parameter info (within method call arguments)
`Ctrl + Q` 快速查找文档
`Ctrl + 鼠标滑过` 简明信息查看
`Ctrl + F1` 在插入符号处显示错误或者警告信息
`Alt + Insert` 生成代码...(Getters,Setters,Constructors)
`Ctrl + O` 重写方法
`Ctrl + I` 实现方法
@gunnarlium
gunnarlium / guzzle-retry.php
Created December 17, 2015 16:23
Example of how to create a retry subscriber for Guzzle 6
<?php
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Request as Psr7Request;
use GuzzleHttp\Psr7\Response as Psr7Response;
use Psr\Log\LoggerInterface;
const MAX_RETRIES = 2;
/**
* 获取该条记录的自增ID
* 将自增转换为62进制,并拼接网址 如:http://qetee.com/w7e
* 用户访问到 http://qetee.com/w7e 时,提取短网址后缀 w7e
* 将短网址后缀转换为10进制,得到自增ID号 如:123456
* 使用查询该记录,进行业务逻辑处理(比如跳转)
*/
/**
* 十进制数转换成62进制