Skip to content

Instantly share code, notes, and snippets.

View avx_sigh.md

why doesn't radfft support AVX on PC?

So there's two separate issues here: using instructions added in AVX and using 256-bit wide vectors. The former turns out to be much easier than the latter for our use case.

Problem number 1 was that you positively need to put AVX code in a separate file with different compiler settings (/arch:AVX for VC++, -mavx for GCC/Clang) that make all SSE code emitted also use VEX encoding, and at the time radfft was written there was no way in CDep to set compiler flags for just one file, just for the overall build.

[There's the GCC "target" annotations on individual funcs, which in principle fix this, but I ran into nasty problems with this for several compiler versions, and VC++ has no equivalent, so we're not currently using that and just sticking with different compilation units.]

The other issue is to do with CPU power management.

@jlblancoc
jlblancoc / Install_gcc7_ubuntu_16.04.md
Last active Jul 31, 2022
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; }
@andyrbell
andyrbell / scanner.sh
Last active Jul 20, 2022
Make a pdf look scanned using ImageMagick
View scanner.sh
# 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 Mar 22, 2022
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 Apr 1, 2022
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