Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Palm oil. know the facts!

DrGo

💭
Palm oil. know the facts!
View GitHub Profile
View show_line_diagnostics_bordered.lua
local border_vertical = "║"
local border_horizontal = "═"
local border_topleft = "╔"
local border_topright = "╗"
local border_botleft = "╚"
local border_botright = "╝"
local border_juncleft = "╠"
local border_juncright = "╣"
local if_nil = vim.F.if_nil
@sts10
sts10 / alacritty.yml
Last active March 18, 2023 10:08
My Alacritty config yml for MacOS (compliant with v 0.4.1-dev)
View alacritty.yml
# Configuration for Alacritty, the GPU enhanced terminal emulator
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty it self.
env:
# TERM env customization.
#
# If this property is not set, alacritty will set it to xterm-256color.
#
@cnu
cnu / download.go
Created December 2, 2018 19:23
Download files in Go
View download.go
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
@fracasula
fracasula / context_cancel.go
Last active May 19, 2022 20:49
GoLang exiting from multiple go routines with context and wait group
View context_cancel.go
package main
// Here's a simple example to show how to properly terminate multiple go routines by using a context.
// Thanks to the WaitGroup we'll be able to end all go routines gracefully before the main function ends.
import (
"context"
"fmt"
"math/rand"
"os"
@chandraratnam
chandraratnam / mutt_mbsync_multipleaccounts.md
Last active February 28, 2023 16:19
Mutt + isync mbsync + gmail + multiple accounts.
View mutt_mbsync_multipleaccounts.md

Mutt + isync multiple accounts Unfinished

This is the setup that I use for mutt, I have two google domain account (read as gmail) and an institution where I work and study account. This means I have two gmail accounts and one outlook 365 account that i want to sync and read via mutt.

I want to store all my email locally as I travel a lot and will be in countries without easy internet access. For this I use mbsync (iSync). As it can handle multiple account types easily and efficently.

The setup works this way

[Remote Mail Servers] <= mbsync => [Local Mail Folders]

@lh3
lh3 / getopt.c
Last active November 12, 2022 17:23
Portable getopt/getopt_long from musl
View getopt.c
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include "getopt.h"
char *optarg;
int optind=1, opterr=1, optopt, __optpos, optreset=0;
#define optpos __optpos
@guinso
guinso / MixedWebHosting.go
Last active March 14, 2021 16:39
Example hosting Golang web server where supporting both static file and dynamic request (REST)
View MixedWebHosting.go
/**
This web server serve 2 different type request: [static file] and [dynamic path]
[Static file] URL path: /*
[Dynamic Path] URL path: /api/*
Preparation:
1) Create "static-files" directory to place all static file like index.html
2) Create "dynamic-files" diectory to place all dynamic or hidden logical files, example invoice.pdf
3) Place "index.html" at root of "static-files" directory
4) Place "neon.jpg" (any kind of JPEG file) at root of "dynamic-files" directory
@nucleartide
nucleartide / explicit.js
Last active March 25, 2019 15:08
Explicit Go-style error handling with ES6 destructuring. No more try-catch!
View explicit.js
function explicit(ctx, fn) {
return function() {
try {
const result = fn.apply(ctx, arguments)
return [null, result]
} catch (err) {
return [err, null]
}
}
View .vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic
" http://amix.dk - amix@amix.dk
"
" Version:
" 5.0 - 29/05/12 15:43:36
"
" Blog_post:
" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github
@infogulch
infogulch / multisort.go
Last active May 6, 2016 23:59
How to design a Go slice type that needs to be sortable in many ways.
View multisort.go
// How to design a Go slice type that needs to be sortable in many ways.
package main
import (
"fmt"
"sort"
)
type data struct {
i int