Skip to content

Instantly share code, notes, and snippets.

View samirkape's full-sized avatar
💬

Samir Kape samirkape

💬
View GitHub Profile
@samirkape
samirkape / .gitback
Created April 2, 2021 06:46
Create a backup of changed git files for some reason
function gback()
{
#Setup backup dir name
name=`date +"%I:%M:%S"`
date=`date +"%d-%m-%y"`
dir="/home/"$USER"/Desktop/store/$date/$name"
mkdir -p $dir
#Store git diff result for reference
echo "Generate: git diff results.."
@samirkape
samirkape / .gitreset
Created March 8, 2021 03:50
Accidental git reset --hard : Future damage control
function grh()
{
#Pass any arbitary argument to this command ( e.g. grh 1 ) to skip backup
if [ "$1" ]
then
echo "Skip backup? (y/n): "
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;then
echo "Run: git reset --hard without creating backup"
git reset --hard
// a minimal http server
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, req *http.Request) {
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
)
func main() {
@samirkape
samirkape / hello-world.go
Last active February 13, 2021 14:12
Hello, World in Go
package main
import "fmt"
func main() {
fmt.Println("Hello, World")
}