Skip to content

Instantly share code, notes, and snippets.

View DrGo's full-sized avatar
💭
Palm oil. know the facts!

DrGo

💭
Palm oil. know the facts!
View GitHub Profile
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
@yegappan
yegappan / VimScriptForPythonDevelopers.MD
Last active January 12, 2024 10:51
Vim script for Python Developers

Vim Script for Python Developers

This is a guide to Vim Script development for Python developers. Sample code for the various expressions, statements, functions and programming constructs is shown in both Python and Vim Script. This is not intended to be a tutorial for developing Vim scripts. It is assumed that the reader is familiar with Python programming.

For an introduction to Vim Script development, refer to usr_41.txt, eval.txt and Learn Vimscript the Hard Way

For a guide similar to this one for JavaScript developers, refer to Vim Script for the JavaScripter

This guide only describes the programming constructs that are present in both Python and Vim. The constructs that are unique to Vim (e.g. autocommands, [key-mapping](https://vimhelp.org/map.txt.html#key-m

@sts10
sts10 / alacritty.yml
Last active December 20, 2023 13:54
My Alacritty config yml for MacOS (compliant with v 0.4.1-dev)
# 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
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
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 March 27, 2024 00:46
Mutt + isync mbsync + gmail + multiple accounts.

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
#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)
/**
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!
function explicit(ctx, fn) {
return function() {
try {
const result = fn.apply(ctx, arguments)
return [null, result]
} catch (err) {
return [err, null]
}
}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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