Skip to content

Instantly share code, notes, and snippets.

@nicowilliams
nicowilliams / fork-is-evil-vfork-is-good-afork-would-be-better.md
Last active Jan 28, 2022
fork() is evil; vfork() is goodness; afork() would be better; clone() is stupid
View fork-is-evil-vfork-is-good-afork-would-be-better.md

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*()](http://pubs.opengroup.org/onlinepubs/9699919

@jesperorb
jesperorb / cors.md
Last active Jan 16, 2022
Handle CORS Client-side
View cors.md

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:

Access-Control-Allow-Origin
@yangyuqian
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 (
"os"
"os/signal"
"syscall"
@rajadain
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("github.com"), domain("gist.github.com"), domain("render.githubusercontent.com") {
/* Hasklig https://github.com/i-tu/Hasklig */
/* Fira Code https://github.com/tonsky/FiraCode */
/* Ligaturizer https://github.com/ToxicFrog/Ligaturizer */
.branch-name,
.blob-num,
.blob-code-inner,
.CodeMirror pre,
.commit .sha,
.commit-desc pre,
@Adron
Adron / install-golang-apt-get.sh
Last active Jan 12, 2022
Installing golang via apt-get
View install-golang-apt-get.sh
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
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"
Return
g_AbortSendEsc := false
#InstallKeybdHook
SetCapsLockState, alwaysoff
Capslock::
g_DoNotAbortSendEsc := true
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active Jan 20, 2022
What I Wish I'd Known About Equity Before Joining A Unicorn
View what-i-wish-id-known-about-equity-before-joining-a-unicorn.md

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
sebp / python-scientific-computing.md
Last active Oct 13, 2021
Overview of Python Packages for Scientific Computing
View python-scientific-computing.md
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'
services:
roach-ui:
image: cockroachdb/cockroach:beta-20161215
command: start --insecure
ports:
- 8080:8080
networks:
- roachnet