Skip to content

Instantly share code, notes, and snippets.

@nopcall
nopcall / SurfingkeysDraculaThemeAttempt.txt
Created January 14, 2021 03:24 — forked from emraher/SurfingkeysDraculaThemeAttempt.txt
Surfingkeys Dracula Theme Attempt
// -----------------------------------------------------------------------------------------------------------------------
// // Surfingkeys: https://github.com/brookhong/Surfingkeys#properties-list
// // Dracula Theme: https://github.com/dracula/dracula-theme#color-palette
// -----------------------------------------------------------------------------------------------------------------------
// Map Keys
// -----------------------------------------------------------------------------------------------------------------------
unmap('ox');
unmap('oh');
unmap('om');
unmap('on');
@nopcall
nopcall / howto-k8s.md
Created January 2, 2021 13:43 — forked from thanatos/howto-k8s.md
How to init k8s cluster on Gentoo

Install Stuff

Emerge kubelet, kubeadm, kubectl, all the same version. For some reason, Gentoo stablized kubelet and kubectl but not kubeadm.

I'm using Calico, so also emerge net-misc/calico-cni-plugin.

Correct Stuff

@nopcall
nopcall / docker-cleanup-resources.md
Created May 3, 2019 18:24 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@nopcall
nopcall / layout.kbd.json
Last active February 1, 2022 03:51
Untitled Keyboard Layout
[
[
{
"x": 3.5,
"c": "#f7f2ea"
},
"#\n3",
{
"x": 10.5
},
@nopcall
nopcall / asyncio_unittest.py
Created April 3, 2018 09:50 — forked from ly0/asyncio_unittest.py
asyncio unittest
import unittest
import asyncio
import inspect
def async_test(f):
def wrapper(*args, **kwargs):
if inspect.iscoroutinefunction(f):
future = f(*args, **kwargs)
else:
@nopcall
nopcall / cVim-alfred.css
Created September 6, 2017 02:35 — forked from franklinjavier/cVim-alfred.css
cVim theme inspired by Yosemite Spotlight
#cVim-link-container, .cVim-link-hint, #cVim-command-bar, #cVim-command-bar-mode, #cVim-command-bar-input, #cVim-command-bar-search-results, .cVim-completion-item, .cVim-completion-item .cVim-full, .cVim-completion-item .cVim-left, .cVim-completion-item .cVim-right, #cVim-hud, #cVim-status-bar {
font-family: Helvetica, Helvetica Neue, Neue, sans-serif, Arial;
font-size: 9pt !important;
-webkit-font-smoothing: antialiased !important;
border-radius: 4px!important;
}
#cVim-link-container {
position: absolute;
pointer-events: none;
@nopcall
nopcall / findEntry.py
Created July 14, 2017 10:07
find entry point of loop linked list
#!/bin/env python3
class Node:
def __init__(self, data, next=None):
self.data = data
self.next = next
def findEntry(root):
@nopcall
nopcall / mydispatch.py
Created June 15, 2017 09:39
dispather
#!/bin/env python3
# -*- coding: utf-8 -*-
class dispatch:
class _handler:
def __init__(self):
self._handleTale = {}
def register(self, argType):
@nopcall
nopcall / wsgi和tornado.md
Created May 14, 2017 11:38 — forked from nature-python/wsgi和tornado.md
python wsgi 与 tornado

#WSGI:(web server gateway interface)WEB服务器网关接口 WSGI是为python语言定义的web服务器和web应用程序或框架之间的一种简单而实用的借口。wsgi是一个web组件的接口规范,它将web组件分为三类:server,middleware,application

##wsgi server wsgi server可以理解为一个符合wsgi规范的web server,接收request请求,封装一系列环境变量,按照wsgi规范调用注册的wsgi app,最后将response返回给客户端。文字很难解释清楚wsgi server到底是什么东西,以及做些什么事情,最直观的方式还是看wsgi server的实现代码。以python自带的wsgiref为例,wsgiref是按照wsgi规范实现的一个简单wsgi server。其工作流程如下:

  1. 服务器创建socket,监听端口,等待客户端连接。
  2. 当有请求来时,服务器解析客户端信息放到环境变量environ中,并调用绑定的handler来处理请求。
  3. handler解析这个http请求,将请求信息例如method,path等放到environ中。
  4. wsgi handler再将一些服务器端信息也放到environ中,最后服务器信息,客户端信息,本次请求信息全部都保存到了环境变量environ中。
@nopcall
nopcall / cvimrc
Last active April 2, 2019 06:10
Google Chrome cvim setting
" {{{ Convenience
set hud
set smoothscroll
set noautofocus
set typelinkhints
"set showtabindices
set autohidecursor
" use <C-n> and <C-p> to cycle through completion results (requires you to set)
" the nextCompletionResult keybinding in the chrome://extensions page (bottom right)