Skip to content

Instantly share code, notes, and snippets.

View andreis's full-sized avatar

andreis

View GitHub Profile
@maxivak
maxivak / readme.md
Last active April 11, 2023 15:08
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 May 3, 2024 08:18
Swift Concurrency Manifesto
@jsmouret
jsmouret / struct.go
Last active November 1, 2022 10:06
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 April 29, 2024 17:57
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/
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 November 5, 2023 12:14
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

@jesperorb
jesperorb / cors.md
Last active February 21, 2024 14:17
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:

Access-Control-Allow-Origin
@yangyuqian
yangyuqian / graceful_exit.go
Created March 10, 2017 02:08
Graceful Exit in Go Program
/*
* 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 February 6, 2019 19:43
Hasklig / Fira Code on GitHub Stylish 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,