Skip to content

Instantly share code, notes, and snippets.

View jhchabran's full-sized avatar
🧀

Jean-Hadrien Chabran jhchabran

🧀
View GitHub Profile

Debugging Go

@praveen-palanisamy
praveen-palanisamy / tree_to_github_markdown.sh
Last active February 10, 2024 06:14
Convert output of tree utility to Markdown in a pretty format. Useful to display code/directory structure
#!/usr/bin/env bash
#File: tree2githubmd
#Description: Convert output of unix tree utility to Github flavoured Markdown
tree=$(tree -f --noreport --charset ascii $1 |
sed -e 's/| \+/ /g' -e 's/[|`]-\+/ */g' -e 's:\(* \)\(\(.*/\)\([^/]\+\)\):\1[\4](\2):g')
printf "# Code/Directory Structure:\n\n${tree}"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@moklett
moklett / task1.exs
Last active April 18, 2023 19:58
Elixir Task - Crash Handling
# This demonstrates that, when using async/await, a crash in the task will crash the caller
defmodule Tasker do
def good(message) do
IO.puts message
end
def bad(message) do
IO.puts message
raise "I'm BAD!"
end
@mholt
mholt / transcript
Created February 26, 2016 18:42
Is it necessary to consume response body before closing it (net/http client code)?
mholt [9:10 AM]
When using http.Get(), is it really necessary to read the full response body just to close it later?
[9:10]
The docs keep saying `Caller should close resp.Body when done reading from it.` and I keep seeing code like this:
```
io.Copy(ioutil.Discard, resp.Body)
resp.Body.Close()
```
@lmarkus
lmarkus / README.MD
Last active March 27, 2024 07:15
Extracting / Exporting custom emoji from Slack

Extracting Emoji From Slack!

Slack doesn't provide an easy way to extract custom emoji from a team. (Especially teams with thousands of custom emoji) This Gist walks you through a relatively simple approach to get your emoji out.

If you're an admin of your own team, you can get the list of emoji directly using this API: https://api.slack.com/methods/emoji.list. Once you have it, skip to Step 3

HOWEVER! This gist is intended for people who don't have admin access, nor access tokens for using that list.

Follow along...

" NeoBundle
"
if has('vim_starting')
set runtimepath+=~/.nvim/bundle/neobundle.vim/
endif
call neobundle#begin(expand('~/.nvim/bundle'))
NeoBundleFetch 'Shougo/neobundle.vim'
" Completion
NeoBundle 'Shougo/deoplete.nvim'
@allgress
allgress / reagent_datascript.cljs
Last active February 16, 2023 21:16
Test use of DataScript for state management of Reagent views.
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))
@axgle
axgle / sync.Pool.md
Last active December 18, 2022 09:56

What is sync.Pool in golang and How to use it

sync.Pool (1/2)

Many Go libraries include custom thread-safe free lists, like this:

var objPool = make(chan *Object, 10)

func obj() *Object {

select {