Skip to content

Instantly share code, notes, and snippets.

View arsham's full-sized avatar

Arsham Shirvani arsham

View GitHub Profile
@arsham
arsham / curl_cookies.sh
Created April 11, 2018 20:33
Curl: using cookies
# record the cookie
curl -c cookie.txt <URL>
# use the cookie
curl -b cookie.txt <URL>
@arsham
arsham / curl_post_value.sh
Created April 11, 2018 17:23
Curl: post values and only see the headers while following redirects.
curl -L -s -v -F 'var1=value1' -F 'var2=value2' <URL> -o /dev/null
@arsham
arsham / curl_follow.sh
Created April 11, 2018 16:37
Curl: follow redirects
curl -L <URL>
@arsham
arsham / curl_headers.sh
Created April 11, 2018 16:37
Curl: show only headers
curl -L -s -v <URL> -o /dev/null
@arsham
arsham / print_repeat.sh
Created April 6, 2018 06:10
Repeatedly print a character in zsh
repeat 100 printf "#"; print
@arsham
arsham / line_by_line.go
Created April 2, 2018 22:55
Read file line by line in #golang
package main
import (
"bufio"
"os"
)
// reads the file line by line.
func lineByLine(filename string) error {
file, err := os.Open(filename)
@arsham
arsham / nil_interface_value.go
Last active April 2, 2018 22:56
Comparing an interface value with nil in #golang
package main
import (
"fmt"
"reflect"
)
// See nil_interface_value_example.go
func main() {
@arsham
arsham / install_debian_package.sh
Last active April 2, 2018 23:01
Install a debian package under #ArchLinux
yaourt -S debtap
sudo -u debtap
debtap <package.deb>
sudo pacman -U <package.pkg.tar.xz>
@arsham
arsham / files_not_containing_string.sh
Last active April 2, 2018 22:57
Find files not containing a string with grep. #bash #zsh #shell
grep -L <TEXT> --exclude "<EXCLUDE PATTERN>" */**/*
@arsham
arsham / reflex runs go test
Created March 24, 2018 03:16
reflex runs go test
# reflex -d none -c tasks.txt -e
-r '\.go$' -- bash -c 'go test ./... ; echo "----------"'