Skip to content

Instantly share code, notes, and snippets.

View najamsk's full-sized avatar
🏠
Working from home

Najam Sikander Awan najamsk

🏠
Working from home
View GitHub Profile
@najamsk
najamsk / 1.go
Created November 8, 2022 07:46
gorilla streaming response
func StreamHandler(w http.ResponseWriter, r *http.Request) {
log.Println("string handler invoked")
for i := 0; i < 15000; i++ {
w.Write([]byte("Gorilla! \n"))
w.(http.Flusher).Flush()
time.Sleep(1 * time.Second)
// time.Sleep(1 * time.Second)
}
fmt.Println("done")
}
@najamsk
najamsk / docker.sh
Last active October 29, 2022 20:57
running persistant postgresql db and pgadmin with docker
docker run -p 5432:5432 -d \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_DB=stripe-example \
-v ~/dockerVols/pg:/var/lib/postgresql/data \
postgres
package main
import (
"encoding/json"
"github.com/gorilla/mux"
"log"
"net/http"
)
type SomeStruct struct {
@najamsk
najamsk / plugs
Created January 10, 2022 10:15
plug.vim
" vim-plug: Vim plugin manager
" ============================
"
" Download plug.vim and put it in ~/.vim/autoload
"
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"
" Edit your .vimrc
"
# Cassandra storage config YAML
# NOTE:
# See http://wiki.apache.org/cassandra/StorageConfiguration for
# full explanations of configuration directives
# /NOTE
# The name of the cluster. This is mainly used to prevent machines in
# one logical cluster from joining another.
cluster_name: 'Test Cluster'
@najamsk
najamsk / gist:a2daaadf047e68be1ae3
Created February 26, 2015 04:33
nike better world parallex effect
//http://www.smashingmagazine.com/2011/07/12/behind-the-scenes-of-nike-better-world/
$('section[data-type="background"]').each(function(){
// Store some variables based on where we are
var $self = $(this),
offsetCoords = $self.offset(),
topOffset = offsetCoords.top;
// When the window is scrolled...
@najamsk
najamsk / gmailsmtp
Last active August 29, 2015 14:07
send emails with powershell
$EmailFrom = "from@mail.com"
$EmailTo = "to@mail.com"
$Subject = "emailing powershell report"
$Body = "this should work on remove server as well. test email"
$SMTPServer = "smtp.gmail.com"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("gmailUser", "gmailPasswor");
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
@najamsk
najamsk / gBfhE.markdown
Last active August 29, 2015 14:02
A Pen by najam awan.
@najamsk
najamsk / iHqLg.markdown
Last active August 29, 2015 14:02
A Pen by najam awan.
@najamsk
najamsk / gist:7097170
Created October 22, 2013 08:36
removing/uninstalling mongodb from services
D:\mongodb\bin>mongod --remove