Skip to content

Instantly share code, notes, and snippets.

View davidbarsky's full-sized avatar

David Barsky davidbarsky

View GitHub Profile
@hroi
hroi / fish_jj_prompt.fish
Last active December 16, 2024 19:12
Jujutsu (jj) prompt for fish-shell
# Place me in ~/.config/fish/functions
# Then add me to `fish_vcs_prompt`: `funced fish_vcs_prompt`
function fish_jj_prompt --description 'Write out the jj prompt'
# Is jj installed?
if not command -sq jj
return 1
end
# Are we in a jj repo?

Remote Development in Zed

At Zed we believe that great things are built by great people working together. We have designed Zed to help every individual work faster and to help teams of people work together more effectively.

Remote development allows you to launch a headless version of Zed on a development server, so that you and your team can edit projects without cloning them locally.

NOTE remote development is at very early stage of preview release with a number of limitations. Notably, you cannot currently use Zed’s terminal remotely, setup is very manual still, and we do not have the ability to install extensions on the headless instances of zed. If you’d like to try it out please reach out to [email protected] and ask to be added to the feature flag.

Getting started with remote development

  • Make sure Zed is v0.133.0 or later (cmd-shift-p About)
@thoughtpolice
thoughtpolice / jj-signoff.sh
Last active October 23, 2024 14:46
my jujutsu config
#!/usr/bin/env bash
set -euo pipefail
NAME=$(jj config get user.name)
MAIL=$(jj config get user.email)
SIGNSTR="Signed-off-by: ${NAME} <${MAIL}>"
contents=$(<"$1")
//! Shim to allow using Rusoto with the new Hyper
use bytes::Bytes;
use futures::future::TryFutureExt;
use futures::TryStreamExt;
use futures::{compat::*, lock::Mutex};
use futures01;
use http::header::{HeaderName, HeaderValue};
use http::{HeaderMap, Method};
use hyper;
use rusoto_core::{
@hawkw
hawkw / retry_future.rs
Last active July 29, 2018 15:44
for thramp
extern crate futures;
// XXX I haven't actually tested this, but I think it should work.
use futures::{Async, Future, Poll};
pub struct RetryFuture<F, N> {
current: F,
new_future: N,
retries: usize,
max_retries: Option<usize>,
@spacejam
spacejam / rust-rr-pp.md
Created September 24, 2017 18:22
pretty printing rust with rr

using rust pretty printers with rr

rr is a great debugging tool. it records a trace of a program's execution, as well as the results of any syscalls it executes, so that you can "rewind" while you debug, and get deterministic forward and reverse instrumented playback. it works with rust, but by default if you try it out, it could be pretty ugly when you inspect variables.

install

steps:

  1. get the rust pretty printer python script
  2. configure gdb to automatically load it
@chrisdone
chrisdone / Parsing.md
Last active February 9, 2022 11:50
Good parser messages with Parsec

Intro

I've been working on a parser for a Haskell-like syntax called Duet. In the implementation I've taken particular care to make an awesome tokenizer and parser that is super helpful to learners.

Jasper Van der Jeugt made a talk about producing good error messages recently, which coincides nicely with my parallel work on this. So I thought I'd also share my

@hdragomir
hdragomir / sm-annotated.html
Last active October 9, 2024 00:35
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@viktorklang
viktorklang / Future-retry.scala
Last active July 23, 2023 23:48
Asynchronous retry for Future in Scala
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import akka.pattern.after
import akka.actor.Scheduler
/**
* Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown,
* in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through
* the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure.
@jboner
jboner / latency.txt
Last active December 16, 2024 14:30
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD