Skip to content

Instantly share code, notes, and snippets.

@gpiffault
gpiffault / piecewise.js
Last active April 27, 2024 16:03
Javascript piecewise function factory
function Piecewise(xs, ys) {
return function(x) {
//bisect
var lo = 0, hi = xs.length - 1;
while (hi - lo > 1) {
var mid = (lo + hi) >> 1;
if (x < xs[mid]) hi = mid;
else lo = mid;
}
//project
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 27, 2024 16:04
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@clauswrm
clauswrm / how_to_sign_commits_with_gpg_in_intellij_idea_on_windows.md
Created April 18, 2018 14:38
Steps to enable signing commits with GPG in IntelliJ IDEA on Windows

How to sign commits with GPG in IntelliJ IDEA on Windows

If anyone is having trouble commiting and pushing signed commits in IntelliJ IDEA (or any other JetBrains IDE) like me, here are the steps:

This guide assumes that you have [generated a GPG key added it to your GitHub account][github_sign_gpg].

Signing commits in IntelliJ

  1. Let Git use the pin entry app which comes with gpg4win:
@ultim8k
ultim8k / vim-multiline-comment.md
Last active April 27, 2024 16:00
(un) comment multiple lines vim

From: http://stackoverflow.com/questions/1676632/whats-a-quick-way-to-comment-uncomment-lines-in-vim

For those tasks I use most of the time block selection.

Put your cursor on the first # character, press Ctrl``V (or Ctrl``Q for gVim), and go down until the last commented line and press x, that will delete all the # characters vertically.

For commenting a block of text is almost the same: First, go to the first line you want to comment, press Ctrl``V, and select until the last line. Second, press Shift``I``#``Esc (then give it a second), and it will insert a # character on all selected lines. For the stripped-down version of vim shipped with debian/ubuntu by default, type : s/^/# in the second step instead.

@alexandreteles
alexandreteles / ChatGPT 4.txt
Last active April 27, 2024 16:00
ChatGPT w/ GPT4 system prompt
You are a GPT GPT-4 architecture, based on the GPT-4 architecture.
Knowledge cutoff: 2023-04
Current date: 2023-12-11
Image input capabilities: Enabled
# Tools
## python
@bennyhuo
bennyhuo / init.gradle.kts
Last active April 27, 2024 15:52
How to config mirrors for repositories in Gradle without changing the source code of your project?
fun RepositoryHandler.enableMirror() {
all {
if (this is MavenArtifactRepository) {
val originalUrl = this.url.toString().removeSuffix("/")
urlMappings[originalUrl]?.let {
logger.lifecycle("Repository[$url] is mirrored to $it")
this.setUrl(it)
}
}
}
@chadmayfield
chadmayfield / hashcat_macos.sh
Created June 2, 2017 17:24
Install Hashcat on macOS
#!/bin/bash
git clone https://github.com/hashcat/hashcat.git
mkdir -p hashcat/deps
git clone https://github.com/KhronosGroup/OpenCL-Headers.git hashcat/deps/OpenCL
cd hashcat/ && make
./hashcat --version
./hashcat -b -D 1,2
./example0.sh