Skip to content

Instantly share code, notes, and snippets.

View voyeg3r's full-sized avatar

Sérgio Luiz Araújo Silva voyeg3r

View GitHub Profile
@voyeg3r
voyeg3r / apt-pac.sh
Created January 9, 2018 13:04 — forked from cookiengineer/apt-pac.sh
APT-PAC - pacman with APT syntax
#!/bin/bash
# Save this file as /usr/bin/apt-pac and chmod +x it.
case "$1" in
autoremove)
pacman -Rns $(pacman -Qdtq);
;;
#sponsors_feature, #sponsors_index {
width: 120px;
}
#sponsors_index {
position: absolute;
top: -2px; right: 0;
}
#sponsors_index h2 {
background: #fff url('/images/components.png') -362px -579px;
}
# copy this function into your shell, then check your settings
installnumix (){
[ -d ~/.icons ] || mkdir ~/.icons
[ -d ~/.themes ] || mkdir ~/.themes
cd ~/.themes
git clone https://github.com/numixproject/numix-gtk-theme.git
cd ~/.icons
git clone https://github.com/numixproject/numix-icon-theme.git
git clone https://github.com/numixproject/numix-icon-theme-circle.git
# PS. The mouse and sticky keys indicators require xkbset to be installed, the clock requires the font LCDMono which is located here.
# font lcd mono: https://www.dafont.com/lcd-lcd-mono.font
alignment top_right
color1 burlywood1 #Month color
color2 burlywood4 #Year color
color3 darkgoldenrod4 #Weekdays lived color
color4 cornsilk #Current weekday color
color5 darkgoldenrod1 #Weekdays yet to come color
color6 darkorange3 #Days of month lived color

Insert blank lines only where there is not blank line

This solution will avoid double blank lines

:g/.\n\n\@!/norm o

The magic happens because we are denying a consecutive new line with \n\@!

Insert a blank line after each second line

:%s/^/=(line(".")%3==0?"\n":"")/g

awk ternary operator to insert blank line

seq 10 | awk 'ORS=NR%2 ? RS:RS RS'
seq 10 ........... gives us 1 to 10 (one by line)
| ................ pipes each line to awk

Awk uses a ternary operator like: statemente-condition ? if-true: if-false

@voyeg3r
voyeg3r / zlogin
Last active August 5, 2017 07:09
#
# source: https://github.com/Eriner/zim
# startup file read in interactive login shells
#
# The following code helps us by optimizing the existing framework.
# This includes zcompile, zcompdump, etc.
#
(
# Function to determine the need of a zcompile. If the .zwc file
# This is my attempt to create a lazy loading for
# fasdcd command "z", in this case
# I would like to receive comments and tips to better understaingin the process of creating
# lazy_load functions and how to apply this knowledge to improve zsh startup, specially
# to improve compninit (zsh completion system)
# sources:
# https://kev.inburke.com/kevin/profiling-zsh-startup-time/
# https://github.com/benvan/sandboxd/blob/master/sandboxrc.example
# Function to show full git log
# this function allows you to show a full
# or paged log Full git log
fgitlog (){
PRETTYFORMAT='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
if [ ! -z "$1" ] && [ "$1"=="--no-pager" ]; then
# In order to get radio stations addresses I am normaly
# get the url with "firefox download helper" show url option
# the idea to use tee came from here:
# source: https://shkspr.mobi/blog/2011/11/watching-and-simultaneously-saving-video-in-mplayer/
dumpwnyc () {
station="wnyc"
url="http://fm939.wnyc.org/wnycfm-tunein.aac"
filename=${station}-$(date +%Y-%b-%d--%H.%Mhs).mp3
wget -O - "$url" | tee -ai "$filename" | mpg123 -