Skip to content

Instantly share code, notes, and snippets.

View andreis's full-sized avatar

andreis

View GitHub Profile
1. Install user CSS extension (or similar): https://chrome.google.com/webstore/detail/user-css/okpjlejfhacmgjkmknjhadmkdbcldfcb?hl=en
2. Apply the following style to news.ycombinator.com
.c00, .c00 a:link { color:#000000; }
.c5a, .c5a a:link, .c5a a:visited { color:#000000; }
.c73, .c73 a:link, .c73 a:visited { color:#000000; }
.c82, .c82 a:link, .c82 a:visited { color:#000000; }
.c88, .c88 a:link, .c88 a:visited { color:#000000; }
.c9c, .c9c a:link, .c9c a:visited { color:#000000; }
.cae, .cae a:link, .cae a:visited { color:#000000; }
@andyrbell
andyrbell / scanner.sh
Last active May 31, 2025 00:04
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@maxivak
maxivak / readme.md
Last active April 22, 2025 03:02
Restore repo from Gitlab bundle file

Gitlab exports repositories to tar archive which contains .bundle files.

We have repo.bundle file and we want to restore files from it.

  • create bare repo from bundle file
git clone --mirror myrepo.bundle my.git
@lattner
lattner / TaskConcurrencyManifesto.md
Last active June 3, 2025 20:55
Swift Concurrency Manifesto
@jsmouret
jsmouret / struct.go
Last active January 10, 2025 07:17
Convert map[string]interface{} to a google.protobuf.Struct
package pb
import (
"fmt"
"reflect"
st "github.com/golang/protobuf/ptypes/struct"
)
// ToStruct converts a map[string]interface{} to a ptypes.Struct
@campoy
campoy / settings.json
Created July 24, 2017 21:11
My vscode settings
{
"window.zoomLevel": 0,
"go.lintOnSave": "package",
"editor.fontFamily": "'Fira Code', Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": false,
"workbench.iconTheme": "vs-seti",
"go.addTags": {
"tags": "json",
"options": "json=omitempty",
"promptForTags": true,
// @flow
function getOptions() {
return { num: 42, str: "val" };
// ^ Type of this return is inferred without type annotation.
}
/*::
// ^ Comments like this are part of Flow's Comment Syntax.
// They allow you to include any additional syntax and Flow will parse it
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active May 8, 2025 14:50
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nicowilliams
nicowilliams / fork-is-evil-vfork-is-good-afork-would-be-better.md
Last active May 14, 2025 00:42
fork() is evil; vfork() is goodness; afork() would be better; clone() is stupid

I recently happened upon a very interesting implementation of popen() (different API, same idea) called popen-noshell 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.

This is not a paper. I assume reader familiarity with fork() in particular and Unix in general, though, of course, I link to relevant wiki pages, so if the unfamiliar reader is willing to go down the rabbit hole, they should be able to come ou