Skip to content

Instantly share code, notes, and snippets.

View espaciomore's full-sized avatar

Manuel A. Cerda espaciomore

View GitHub Profile
@espaciomore
espaciomore / watch.sh
Last active August 5, 2024 18:24
Watch command for Git Bash
#!/bin/bash
ARGS="${@}"
clear;
while(true); do
OUTPUT=`$ARGS`
clear
echo -e "${OUTPUT[@]}"
done
@espaciomore
espaciomore / login.sh
Last active March 3, 2017 22:12
Login using Curl saving cookies file
#!/bin/bash
#TIMESTAMP=`date "+%Y%m%d_%H%M%S"`
FILTER="<title>"
REPLACEMENT="s/\s*<\/?title>\s*//g"
RESOURCE1=""
RESOURCE2=""
function get_cookie {
echo "POST $1/$RESOURCE1"
curl -d "$2" -H "Content-Type: application/x-www-form-urlencoded" -X POST "$1/$RESOURCE1" -s -c "cookie"
@espaciomore
espaciomore / pic.go
Created January 1, 2017 16:54
Go Tour - Pic
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
var p [][]uint8 = make([][]uint8, dy)
for i:=0;i<dy;i++ {
p[i] = make([]uint8, dx)
for j:=0;j<dx;j++ {
p[i][j] = uint8((j*i)/10)
@espaciomore
espaciomore / wordcount.go
Created January 1, 2017 16:52
Go Tour - Word Count
package main
import (
"golang.org/x/tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
wordMap := make(map[string]int)
words := strings.Fields(s)