Skip to content

Instantly share code, notes, and snippets.

View andradei's full-sized avatar

Isaac Andrade andradei

View GitHub Profile
➤ rofi -help
rofi usage:
rofi [-options ...]
Command line only options:
-no-config Do not load configuration, use default values.
-v,-version Print the version number and exit.
-dmenu Start in dmenu mode.
-display [string] X server to contact.
${DISPLAY}
@andradei
andradei / 0-ssh-host-to-guest.md
Last active July 15, 2019 04:14
VirtualBox Ubuntu Server 16.04 Development Setup

Setup SSH from Host to Guest on VirtualBox

  1. Make sure VM is shutdown
  2. Go to Network settings of the VM you want to SSH in
  3. Generally the first Adapter is set to NAT. Go to Advanced and click in Port Forwarding
  4. Create a new rule (click in the icon with a "+" sign) and enter:
Name Protocol Host IP Host Port Guest IP Guest Port
ssh TCP 2222 22
@andradei
andradei / main.go
Created March 28, 2016 15:20
The Daily Walk - Go Concurrency Exercise
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
var (
@andradei
andradei / go-impl.sh
Last active March 11, 2016 05:02
Bash function to use Go's tooling
# Implement `oracle implements` with help to find byte offsets to use
# Usage: go-impl [path-to-file].go [identifier type]
# Example: go-impl somepackage/file.go MyType
if [[ -n $1 && -n $2 ]]; then
if [[ -a $1 ]]; then
cat $1 | grep -b $2
echo "Choose a byte offset from the list above"
local byte_offset
read byte_offset
oracle -pos $1:"#"$byte_offset implements
@andradei
andradei / frisk_sargas.zsh-theme
Last active November 27, 2015 19:21
ZSH Themes
PROMPT='
%{$fg[cyan]%}$(virtualenv_prompt_info)%{$reset_color%}%{$fg[blue]%}%c%{$reset_color%} $(git_prompt_info)$(bzr_prompt_info)%{$fg[yellow]%}[%T]%{$reset_color%} %{$fg_bold[white]%}➤%{$reset_color%} '
PROMPT2="%{$fg_bold[black]%}➤ %{$reset_color%}"
GIT_CB="git: "
ZSH_THEME_SCM_PROMPT_PREFIX="%{$fg[green]%}["
ZSH_THEME_GIT_PROMPT_PREFIX=$ZSH_THEME_SCM_PROMPT_PREFIX$GIT_CB
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}"
@andradei
andradei / main.cpp
Created November 17, 2015 00:38
Tic-Tac-Toe in C++
//
// main.cpp
// Tic-Tac-Toe
//
// Created by Isaac Andrade on 9/2/13.
// Copyright (c) 2013 Isaac Andrade. All rights reserved.
//
#include <iostream>
#include <string>
@andradei
andradei / pi_approximation.rb
Created November 17, 2015 00:32
PI Approximation in Ruby
module PiApprox
class PI
attr_accessor :approximation, :denominator, :sum, :signal
def initialize(approx = 0, den = 1.0, sum = 0, signal = true)
@approximation = approx
@denominator = den
@sum = sum
@signal = signal
end
@andradei
andradei / app.py
Last active November 17, 2015 00:43
Async Planet Destroyer in Python (asyncio)
import asyncio
import logging
class Client(asyncio.Protocol):
def __init__(self, loop):
self.loop = loop
def connection_made(self, transport):
@andradei
andradei / 01exercise-loops-and-functions.go
Last active August 29, 2015 14:15
Go Tour Exercises 2015
package main
import (
"fmt"
)
func Sqrt(x float64) float64 {
z := float64(x)
delta := 10.0
var temp float64
@andradei
andradei / sb3_keybindings_vowels.json
Last active December 18, 2023 16:09
Sublime Text 3 Key Bindings for Vowals with Accent (use with keyboard layout US, International with Dead Keys and similar)
[
// Key remaps
// - a
{ "keys": ["alt + ' + a"], "command": "insert", "args": {"characters": "á"}},
{ "keys": ["alt + ` + a"], "command": "insert", "args": {"characters": "à"}},
{ "keys": ["alt + \" + a"], "command": "insert", "args": {"characters": "ä"}},
{ "keys": ["alt + ~ + a"], "command": "insert", "args": {"characters": "ã"}},
// - A