Skip to content

Instantly share code, notes, and snippets.

View anandadake's full-sized avatar

Anand Vitthal Adake anandadake

View GitHub Profile
@anandadake
anandadake / proxy_views.py
Created February 2, 2024 04:57 — forked from joeshaw/proxy_views.py
super-hacky flask proxy
# coding:utf-8
# Copyright 2011 litl, LLC. All Rights Reserved.
import httplib
import re
import urllib
import urlparse
from flask import Blueprint, request, Response, url_for
from werkzeug.datastructures import Headers
@anandadake
anandadake / subprocessdemote.py
Created January 27, 2023 10:09 — forked from sweenzor/subprocessdemote.py
Run python subprocess(es) as another user
#!/usr/bin/env python
import os
import subprocess
# > python subprocessdemote.py
# > sudo python subprocessdemote.py
def check_username():

Spring Security + JWT + REST API

We will create a sample application for JWT + Stateless Token + Spring Security + REST(JSON) API

  1. Create a Spring Boot Project with following dependencies:
    • Spring Web
    • Spring Security
    • Spring Boot DevTools and Other dependencies
@anandadake
anandadake / material.module.ts
Created July 6, 2022 11:21 — forked from Aaron-CR/material.module.ts
Material Module utilizado en el articulo 007-introduccion-a-los-modulos
import { NgModule } from '@angular/core';
// Form Controls
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatRadioModule } from '@angular/material/radio';

Implemenation to execute Command in CMD with java

public String execCmd(String cmd) throws java.io.IOException {
        java.util.Scanner s = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\A");
        return s.hasNext() ? s.next() : "";
}