Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeff Dickey jdxcode

View GitHub Profile
View go15.html
<!--{
"Title": "Go 1.15 Release Notes",
"Path": "/doc/go1.15"
}-->
<!--
NOTE: In this document and others in this directory, the convention is to
set fixed-width phrases with non-fixed-width spaces, as in
<code>hello</code> <code>world</code>.
Do not send CLs removing the interior tags from such phrases.
-->
View fish-cheat-sheet.md

builtin

  • Tab completes the current token. Shift, Tab completes the current token and starts the pager's search mode.
  • Alt+←,Left and Alt+→,Right move the cursor one word left or right (to the next space or punctuation mark), or moves forward/backward in the directory history if the command line is empty. If the cursor is already at the end of the line, and an autosuggestion is available, Alt+→,Right (or Alt+F) accepts the first word in the suggestion.
  • Shift,←,Left and Shift,→,Right move the cursor one word left or right, without stopping on punctuation.
  • ↑ (Up) and ↓ (Down) (or Control+P and Control+N for emacs aficionados) search the command history for the previous/next command containing the string that was specified on the commandline before the search was started. If the commandline was empty when the search started, all commands match. See the history section for more information on history searching.
  • Alt+↑,Up and Alt+↓,Down search the command history for the previous/next token containing th
View downloading node binary script.sh
#!/bin/bash
set -euo pipefail
# Downloads a node tarball from https://nodejs.org/dist/ and extracts just
# the binary into the current directory. Chiefly we use this to get a node
# binary for uploading to manifold.
if [[ $# -ne 4 ]]; then
echo "USAGE: $0 <node_version> <os> <arch> <filename>"
exit 1
View downloading node tarball script.sh
#!/bin/bash
set -euxo pipefail
# Downloads a node tarball from https://nodejs.org/dist/ and extracts just
# the binary into the current directory. Chiefly we use this to get a node
# binary for uploading to manifold.
if [[ $# -ne 4 ]]; then
echo "USAGE: $0 <node_version> <os> <arch> <filename>"
exit 1
@jdxcode
jdxcode / context.cpp
Last active May 4, 2020
c++ check if pid is running
View context.cpp
bool pid_id_active(pid_t pid) {
return kill(pid, 0) == 0;
}
View main.cpp
#include <fstream>
int main() {
std::ofstream f{"myfile.txt"};
f << "sometext" << std::endl;
if (!f)
throw std::system_error(errno, std::system_category(), "failed to open file");
return 0;
}
View gist:c55e231ef6abea6aa10ad9614050fa57
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb
$SelectAll <M-A>
$Undo <M-Z>
View gist:7f56bbecebba7e4841d36e8387ec612c
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb
$SelectAll <M-A>
$Undo <M-Z>
@jdxcode
jdxcode / min_max_heap.py
Last active Feb 16, 2020
max heap in python
View min_max_heap.py
from collections import namedtuple
from typing import TypeVar, Generic, Optional, List, Union, Tuple, Callable, Any
T = TypeVar("T")
class Heap(Generic[T]):
x: List[T]
def __init__(self, key: Callable[[T], Any] = lambda x: x, order="min"):
View gist:a145f1bebc96ef3752af4affe48c9cef
apt-get update
apt-get install -y wget
wget https://cli-assets.heroku.com/branches/stable/heroku-linux-amd64.tar.gz
mkdir -p /usr/local/lib /usr/local/bin
tar -xvzf heroku-linux-amd64.tar.gz -C /usr/local/lib
ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
heroku version
You can’t perform that action at this time.