Skip to content

Instantly share code, notes, and snippets.

View swanandvk's full-sized avatar
:bowtie:
Available to discuss your projects

Swanand Keskar swanandvk

:bowtie:
Available to discuss your projects
View GitHub Profile
@swanandvk
swanandvk / Manjaro fix for pacman corrupted keyring
Created September 11, 2022 05:35
Manjaro fix for pacman corrupted keyring / system update due
sudo rm -f /var/lib/pacman/sync/*
sudo pacman-mirrors --continent
sudo pacman -Syyu

Zip excluding specific directories

Exclude .git file and node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/\*

Exclude .git file and files in node_modules directory, but keep node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/**\*
@swanandvk
swanandvk / postgres_queries_and_commands.sql
Created October 16, 2019 05:06 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
func main(){
fmt.Println("magic is happening on port 8081")
//creating local array
users=append(users,User{ID:"1",Firstname:"Swanand",Lastname:"Keskar"})
users=append(users,User{ID:"2",Firstname:"Akshay",Lastname:"Joshi"})
router:=mux.NewRouter()
router.HandleFunc("/users",GetUsers).Methods("GET")
router.HandleFunc("/users/{id}",GetUserById).Methods("GET")
// array of users
var users []User
func GetUserById(w http.ResponseWriter,req *http.Request){
params:=mux.Vars(req)
for _,item := range users{
if item.ID==params["id"]{
json.NewEncoder(w).Encode(item)
package main
import(
"fmt"
"github.com/gorilla/mux"
"net/http"
"log"
"encoding/json"
)
type User struct{
@swanandvk
swanandvk / gh-pages-deploy.md
Created March 2, 2018 17:52 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

public class MainActivity extends AppCompatActivity implements MainView {
private MainPresenter mainPresenter;
private Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mainPresenter=new MainPresenter(this);
button= (Button) findViewById(R.id.btn);