Skip to content

Instantly share code, notes, and snippets.

View zorgick's full-sized avatar
🐬
Plop!

zorgick

🐬
Plop!
  • Mundus
View GitHub Profile
@awkward-ninja
awkward-ninja / gpgflow.sh
Last active June 28, 2022 08:22
GPG Import / Export / Clone
# Based on the following articles
# https://blog.programster.org/generating-gpg-master-and-subkeys
# https://risanb.com/code/backup-restore-gpg-key/
# https://gist.github.com/oseme-techguy/bae2e309c084d93b75a9b25f49718f85
gpg_keyid() {
gpg2 --list-secret-keys \
| sed -n 's/^ \(\w*\)/\1/p'
}
@wjx0820
wjx0820 / deepClone.js
Last active January 3, 2022 20:34
深拷贝 deepClone
// 通过 typeof 来查看每种数据类型的描述
// [undefined, null, true, '', 0, Symbol(), {}].map(it => typeof it)
// ["undefined", "object", "boolean", "string", "number", "symbol", "object"]
function clone(obj) {
// 添加一个 WeakMap 来记录已经拷贝过的对象,如果当前对象已经被拷贝过,那么直接从 WeakMap 中取出,否则重新创建一个对象并加入 WeakMap 中
// ES6 推出的 WeakMap 对象,该对象是一组键/值对的集合,其中的键是弱引用的。其键必须是对象,而值可以是任意的
let map = new WeakMap();
function deep(data) {
@blurayne
blurayne / ui-widget-select.sh
Last active December 4, 2025 08:51
Pure BASH interactive CLI/TUI menu (single and multi-select/checkboxes)
#!/bin/bash
##
# Pure BASH interactive CLI/TUI menu (single and multi-select/checkboxes)
#
# Author: Markus Geiger <[email protected]>
# Last revised 2019-09-11
#
# ATTENTION! TO BE REFACTORED! FIRST DRAFT!
#

Libuv and libev, two I/O libraries with similar names, recently had the privilege to use both libraries to write something. Now let's talk about my own subjective expression of common and different points.

The topic of high-performance network programming has been discussed. Asynchronous, asynchronous, or asynchronous. Whether it is epoll or kqueue, it is always indispensable to the asynchronous topic.

Libuv is asynchronous, and libev is synchronous multiplexing IO multiplexing.

Libev is a simple encapsulation of system I/O reuse. Basically, it solves the problem of different APIs between epoll and kqueuq. Ensure that programs written using livev's API can run on most *nix platforms. However, the disadvantages of libev are also obvious. Because it basically just encapsulates the Event Library, it is inconvenient to use. For example, accept(3) requires manual setnonblocking after connection. EAGAIN, EWOULDBLOCK, and EINTER need to be detected when reading from a socket. This is a

@pjf
pjf / .taskrc
Created December 5, 2017 00:05
pjf's .taskrc file
# [Created by task 2.5.1 2/19/2017 04:19:13]
# Taskwarrior program configuration file.
# For more documentation, see http://taskwarrior.org or try 'man task', 'man task-color',
# 'man task-sync' or 'man taskrc'
# Here is an example of entries that use the default, override and blank values
# variable=foo -- By specifying a value, this overrides the default
# variable= -- By specifying no value, this means no default
# #variable=foo -- By commenting out the line, or deleting it, this uses the default
@turicas
turicas / programming-languages.csv
Created August 10, 2016 02:16
Download list of programming languages from Wikipedia
name wikipedia_url
A# .NET https://en.wikipedia.org/wiki/A_Sharp_(.NET)
A# (Axiom) https://en.wikipedia.org/wiki/A_Sharp_(Axiom)
A-0 System https://en.wikipedia.org/wiki/A-0_System
A+ https://en.wikipedia.org/wiki/A%2B_(programming_language)
A++ https://en.wikipedia.org/wiki/A%2B%2B
ABAP https://en.wikipedia.org/wiki/ABAP
ABC https://en.wikipedia.org/wiki/ABC_(programming_language)
ABC ALGOL https://en.wikipedia.org/wiki/ABC_ALGOL
ABSET https://en.wikipedia.org/wiki/ABSET
@jung-kim
jung-kim / map-weakmap-perf.js
Last active December 9, 2022 08:43
Map vs WeakMap performance
"use strict";
let looper = (callback) => {
let n = 2000000;
while (n > 0) {
callback(n);
n--;
}
}
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@jteneycke
jteneycke / gist:7947353
Last active August 16, 2025 17:19
How to install and configure Common Lisp for Emacs. (SBCL + Slime + Emacs24)

In your shell

sudo apt-get install sbcl
curl -O http://beta.quicklisp.org/quicklisp.lisp
sbcl --load quicklisp.lisp

Inside the context of sbcl

@prabirshrestha
prabirshrestha / detect-os.sh
Created July 10, 2012 02:04
detect os in bash
#!/bin/sh
UNAME=$(uname)
if [ "$UNAME" == "Linux" ] ; then
echo "Linux"
elif [ "$UNAME" == "Darwin" ] ; then
echo "Darwin"
elif [[ "$UNAME" == CYGWIN* || "$UNAME" == MINGW* ]] ; then