Skip to content

Instantly share code, notes, and snippets.

View easbarba's full-sized avatar
☀️
Praise the sun!

Alexander Barbosa easbarba

☀️
Praise the sun!
View GitHub Profile
@easbarba
easbarba / exwm-status.el
Last active September 13, 2019 05:43
EXWM - Status Bar (echo-area) w/ icons
;; TODO: Proper all-the-icons usage
;; TODO: Modular stats
;; TODO: Emacs package?
;; TODO: Portable
(require 'all-the-icons)
(require 'subr-x)
(let ((bat
(concat
(string-trim
@easbarba
easbarba / dotnetlayout.md
Created April 10, 2020 16:03 — forked from davidfowl/dotnetlayout.md
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
(defun a/_exwm-statusbar-battery ()
"Get laptop battery current capacity."
(let ((bat
(concat
(string-trim
(shell-command-to-string
"cat /sys/class/power_supply/BAT0/capacity"))
"%")))
bat))
{
"name": "emacs",
"url": "https://git.savannah.gnu.org/git/emacs",
"tag": "emacs-27.1-rc1",
"commands": [
["make", "distclean"],
["sh", "autogen.sh"],
["sh", "configure --prefix={ _local } --with-modules --with-xwidgets --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xft --with-xpm --with-x --with-dbus --with-imagemagick --with-mailutils --with-gnutls --with-x-toolkit=gtk3"],
["make", "-j2"],
["make", "install"]
using System;
namespace test
{
class Program
{
static void Main()
{
var fruit ="apple";
var flavor = "orange";
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
expand-file-name(nil)
userlock--check-content-unchanged("/dados/Pessoal/lsp-mode/docs/page/lsp-bash.md")
userlock--ask-user-about-supersession-threat("/dados/Pessoal/lsp-mode/docs/page/lsp-bash.md")
write-region(1 116 "/dados/Pessoal/lsp-mode/docs/page/lsp-bash.md" t)
append-to-file(1 116 "/dados/Pessoal/lsp-mode/docs/page/lsp-bash.md")
(progn (insert-file-contents "../template/lsp-client-var.md") (while (re-search-forward "{{\\([][:word:]\\[.-]+\\)}}" nil t) (let* ((key (match-string 1)) (value (lsp-doc--variable->value it key client))) (replace-match value t t))) (append-to-file (point-min) (point-max) file))
(unwind-protect (progn (insert-file-contents "../template/lsp-client-var.md") (while (re-search-forward "{{\\([][:word:]\\[.-]+\\)}}" nil t) (let* ((key (match-string 1)) (value (lsp-doc--variable->value it key client))) (replace-match value t t))) (append-to-file (point-min) (point-max) file)) (and (buffer-name temp-buffer)
@easbarba
easbarba / config.py
Created December 9, 2020 04:04
Qtile configuration file
#!/usr/bin/env python3
"""Qtile configuration."""
from pathlib import Path
from shutil import which
from dataclasses import dataclass
try:
from typing import List # noqa: F401
@easbarba
easbarba / config
Created December 9, 2020 04:08
i3wm config
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
@easbarba
easbarba / setup
Created May 3, 2021 08:54 — forked from ejpcmac/setup
Setup script for Phoenix projects using Nix and PostgreSQL
#!/bin/sh
echo
if [ ! -d "deps" ] || [ ! "$(ls -A deps)" ]; then
printf "\e[32m=> Fetching dependencies and building the application...\e[0m\n\n"
echo "+ mix do deps.get, compile --verbose"
mix do deps.get, compile --verbose
echo
fi

progrium/bashstyle

Bash is the JavaScript of systems programming. Although in some cases it's better to use a systems language like C or Go, Bash is an ideal systems language for smaller POSIX-oriented or command line tasks. Here's three quick reasons why:

  • It's everywhere. Like JavaScript for the web, Bash is already there ready for systems programming.
  • It's neutral. Unlike Ruby, Python, JavaScript, or PHP, Bash offends equally across all communities. ;)
  • It's made to be glue. Write complex parts in C or Go (or whatever!), and glue them together with Bash.

This document is how I write Bash and how I'd like collaborators to write Bash with me in my open source projects. It's based on a lot of experience and time collecting best practices. Most of them come from these two articles, but here integrated, slightly modified, and focusing on the most bang for buck items. Plus some ne