Skip to content

Instantly share code, notes, and snippets.

nicowilliams /
Last active Jan 28, 2022
fork() is evil; vfork() is goodness; afork() would be better; clone() is stupid

I recently happened upon an implementation of popen() (different API, same idea) using clone(2), and so I opened an issue requesting use of vfork(2) or posix_spawn() for portability. It turns out that on Linux there's an important advantage to using clone(2). I think I should capture the things I wrote there in a better place. A gist, a blog, whatever.

So here goes.

Long ago, I, like many Unix fans, thought that fork(2) and the fork-exec process spawning model were the greatest thing, and the Windows sucked for only having [exec*()](

jesperorb /
Last active Jan 16, 2022
Handle CORS Client-side

Handle CORS Client-side

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.

Sources : MDN - HTTP Access Control | Wiki - CORS

CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header:

yangyuqian / graceful_exit.go
Created Mar 10, 2017
Graceful Exit in Go Program
View graceful_exit.go
* Killing a program immediately sometimes leads to corrupted data or files, which brings unexpected result in your system.
* In Go, you can catch the termination signals and let your program decide the time of exiting.
package main
import (
rajadain / github-hasklig-fira-code-style.css
Last active Feb 6, 2019
Hasklig / Fira Code on GitHub Stylish CSS
View github-hasklig-fira-code-style.css
@-moz-document domain(""), domain(""), domain("") {
/* Hasklig */
/* Fira Code */
/* Ligaturizer */
.CodeMirror pre,
.commit .sha,
.commit-desc pre,
Adron /
Last active Jan 12, 2022
Installing golang via apt-get
sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install golang
# Usually this is good to install golang, but alas the apt-get repo is usually out of sync with the latest.
nocaoper / CapsLockCtrlEscape.ahk
Last active Jun 29, 2021 — forked from sedm0784/CapsLockCtrlEscape.ahk
Shift_CapsLock gives the original capsLock behaviour.... reload script on error
View CapsLockCtrlEscape.ahk
LShift & Capslock::
SetCapsLockState, % (State:=!State) ? "on" : "alwaysoff"
g_AbortSendEsc := false
SetCapsLockState, alwaysoff
g_DoNotAbortSendEsc := true
yossorion /
Last active Jan 20, 2022
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

sebp /
Last active Oct 13, 2021
Overview of Python Packages for Scientific Computing
View ABRMS License
This software is licensed under the "Anyone But Richard M Stallman"
(ABRMS) license, described below. No other licenses may apply.
Copyright (c) [year] [full name]
Permission is hereby granted to any person obtaining a copy of this software and/or source code
to do whatever they see fit. This includes but is not limited to use, copy, modify,
publish/distribute and/or sell. Subject to the following conditions/exceptions:
1. The above copyright notice and this license shall be included in every copy or/and portions
View docker-compose.yml
version: '2'
image: cockroachdb/cockroach:beta-20161215
command: start --insecure
- 8080:8080
- roachnet