Skip to content

Instantly share code, notes, and snippets.

@jlblancoc
jlblancoc / Install_gcc7_ubuntu_16.04.md
Last active Nov 24, 2021
Installing gcc-7 & g++-7 in Ubuntu 16.04LTS Xenial
View Install_gcc7_ubuntu_16.04.md

Run the following in the terminal:

Install the gcc-7 packages:

sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-7 -y

Set it up so the symbolic links gcc, g++ point to the newer version:

View grecaptcha.kt
package utils
import org.w3c.dom.HTMLElement
@JsName("grecaptcha")
external object GoogleRecaptcha {
fun render(element: HTMLElement, options: RecaptchaOptions)
}
class RecaptchaOptions(val sitekey: String, val callback: String, val size: String)
View gist:ac936f87662ed0b1f6def0a65f870c69
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; }
@maxivak
maxivak / readme.md
Last active Dec 6, 2021
Restore repo from Gitlab bundle file
View readme.md

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
@jsmouret
jsmouret / struct.go
Last active Nov 16, 2021
Convert map[string]interface{} to a google.protobuf.Struct
View struct.go
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 Jul 24, 2017
My vscode settings
View settings.json
{
"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,
View extracting-values-in-comments.js
// @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 Dec 3, 2021
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/
View understanding-word-vectors.ipynb
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 Dec 3, 2021
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