Skip to content

Instantly share code, notes, and snippets.

@pandeybk
pandeybk / hpphil.srt
Created May 1, 2020 04:34 — forked from alaroldai/hpphil.srt
Subtitles for Harry Potter and the Philosopher's Stone, with some substitutions
1
00:01:22,064 --> 00:01:27,070
I should've known that you would
be here, Professor McGonagall.
2
00:01:38,290 --> 00:01:41,460
Good evening, Professor Dumbledore.
3
@pandeybk
pandeybk / 1_create_net_subnet_image_flavor.md
Created April 26, 2020 21:18 — forked from arcolife/1_create_net_subnet_image_flavor.md
openstack 10 (newton) network router create

create network / subnet / image / flavor

# create a net and a subnet
i=1;
while [ $i -lt 51 ]; do 
  neutron net-create scalenet$i --shared; 
  j=0; 
@pandeybk
pandeybk / keycloak.sh
Last active December 16, 2019 16:29 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example
#!/bin/bash
export KEYCLOAK_URL="http://localhost:8080"
export USERNAME="admin"
export PASSWORD="password"
export CLIENT_ID="admin-cli"
export TKN=$(curl -X POST "$KEYCLOAK_URL/auth/realms/master/protocol/openid-connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=${USERNAME}" \
@pandeybk
pandeybk / KeycloakClientAuthExample.java
Created April 4, 2018 02:56 — forked from thomasdarimont/KeycloakClientAuthExample.java
Retrieve and verify AccessToken with Keycloak Client.
package de.tdlabs.keycloak.client;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.keycloak.OAuth2Constants;
import org.keycloak.RSATokenVerifier;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.KeycloakBuilder;
import org.keycloak.common.VerificationException;
import org.keycloak.jose.jws.JWSHeader;
import org.keycloak.representations.AccessToken;
@pandeybk
pandeybk / KeycloakAdminClientExample.java
Created April 3, 2018 17:25 — forked from thomasdarimont/KeycloakAdminClientExample.java
Using Keycloak Admin Client to create user with roles (Realm and Client level)
package de.tdlabs.keycloak.client;
import java.util.Arrays;
import java.util.Collections;
import javax.ws.rs.core.Response;
import org.keycloak.OAuth2Constants;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.KeycloakBuilder;
# Copying kubernetes resources accross namespaces
kubectl get rs,secrets -o json --namespace old | jq '.items[].metadata.namespace = "new"' | kubectl create -f -
kubectl get cm -o json --namespace old some-config-map | jq '.metadata.namespace = "new"' | kubectl create -f -
# kubectl exec in each pods
for pod in `kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'`; do echo $pod date:; kubectl exec -it $pod -- date ; echo "--------------"; done
@pandeybk
pandeybk / clean-docker-for-mac.sh
Created November 30, 2016 18:20 — forked from MrTrustor/clean-docker-for-mac.sh
This script cleans the Docker.qcow2 file that takes a lot of disk space with Docker For Mac. You can specify some Docker images that you would like to keep.
#!/bin/bash
IMAGES=$@
echo "This will remove all your current containers and images except for:"
echo ${IMAGES}
read -p "Are you sure? [yes/NO] " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
@pandeybk
pandeybk / countries.sql
Created July 30, 2016 02:51 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@pandeybk
pandeybk / SimpleAuthServer.py
Created July 28, 2016 18:40 — forked from fxsjy/SimpleAuthServer.py
SimpleAuthServer: A SimpleHTTPServer with authentication
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import sys
import base64
key = ""
class AuthHandler(SimpleHTTPRequestHandler):
''' Main class to present webpages and authentication. '''
def do_HEAD(self):
@pandeybk
pandeybk / hello-revinate.pl
Last active April 5, 2016 21:24
Hello Revinate
use re 'eval';
'?'
=~( '('
.'?'. '{'.
('`'| '%').
('[' ^'-'
).''. ('`'|
'!') .''.
('`'| ',').
(( '"')) . ( ('[')^