Skip to content

Instantly share code, notes, and snippets.

View sbose78's full-sized avatar
🎯
Focusing

Shoubhik Bose sbose78

🎯
Focusing
View GitHub Profile
func deleteNamespace(t *testing.T, clientset *kubernetes.Clientset, namespace string) {
if err := clientset.CoreV1().Namespaces().Delete(namespace, &metav1.DeleteOptions{}); err != nil {
t.Logf("error deleting namespace %q: %v", namespace, err)
}
t.Logf("successfully deleted namespace: %q", namespace)
}
@sbose78
sbose78 / analytics.java
Last active February 8, 2018 08:24
frost-java
try {
Map<String, String> effectivePomFiles = new HashMap<String, String>();
for (IFile pomFile : pomFiles) {
IMavenProjectRegistry registry = MavenPlugin.getMavenProjectRegistry();
IMavenProjectFacade facade = registry.create(pomFile, true, monitor);
MavenProject mavenProject = facade.getMavenProject(monitor);
StringWriter sw = new StringWriter();
new MavenXpp3Writer().write(sw, mavenProject.getModel());
@sbose78
sbose78 / swagger.yaml
Created January 16, 2018 10:45
fabric8-auth
basePath: /api
consumes:
- application/json
- application/x-www-form-urlencoded
definitions:
AddManyCollaboratorsPayload:
description: Holds the response of user idenitity IDs for updating list of user
IDs
example:
data:
package main
type AuthUserProfileService interface{
Get() string
}
type AuthUserClient struct {
httpClient
config
}
@sbose78
sbose78 / external_token_keycloak.go
Created October 14, 2017 20:19
Tests to retrieve IDP token from keycloak.
package keycloak_test
import (
"context"
"fmt"
"net/http"
"net/url"
"strings"
"testing"
"time"
// Retrieve fetches the stored external provider token.
func (c *TokenController) Retrieve(ctx *app.RetrieveTokenContext) error {
/* currentIdentity, err := login.ContextIdentity(ctx)
if err != nil {
return jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))
}
*/
tokenString := goajwt.ContextJWT(ctx).Raw
Public key added kid=bNq-BCOR3ev-E6buGSaPrU-0SXX8whhDlmZ6geenkTE pkg=token
Public key added kid=9MLnViaRkhVj1GT9kpWUkwHIwUD-wZfUxR-3CpkE-Xs pkg=token
Public keys loaded number_of_keys=1 pkg="github.com/fabric8-services/fabric8-wit/vendor/token" url="https://sso.prod-preview.openshift.io/auth/realms/fabric8-test/protocol/openid-connect/certs"
Public key added kid=bNq-BCOR3ev-E6buGSaPrU-0SXX8whhDlmZ6geenkTE pkg=token
if len(spacesToGetEntitlementsFor) >= maxRecentSpacesForRPT {
// we need to take out the recent 10 spaces.
// So if the array is of length 13 , then we need to cut out
// an array from index 3 to index 12
// start_index = 13 - 10 = 3 , end_index = 13-1
totalNumberOfRecentSpaces := len(spacesToGetEntitlementsFor)
spacesToGetEntitlementsFor = spacesToGetEntitlementsFor[totalNumberOfRecentSpaces-maxRecentSpacesForRPT : totalNumberOfRecentSpaces]
}
@sbose78
sbose78 / gist:977b7c190939e85b2cf3989e36b12d14
Created June 20, 2017 12:29
stacktrace - fabric8 - wit
{"GET":"/api/login/authorize?state=4024bc69-73c2-45ab-a58e-6a0100ebd250\u0026code=uss.W8g-PKx1PAica0bX8RkpjYixyVibj2Vu6P_Zz5PddpY.befcfda2-9b52-4b1b-bd6b-20c53be962b6.87116ebc-3717-4b7f-8eef-72f5f88b9214","action":"Authorize","ctrl":"login","from":"192.168.64.1","level":"info","msg":"request started","pkg":"log.LogRequest.func1","req_id":"xMQISst0Ll-18","time":"2017-06-20 12:27:38"}
runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow
runtime stack:
runtime.throw(0xdabdd3, 0xe)
/usr/local/go/src/runtime/panic.go:596 +0x95
runtime.newstack(0x0)
/usr/local/go/src/runtime/stack.go:1089 +0x3f2
runtime.morestack()
@sbose78
sbose78 / how-to-docker-jenkins.md
Last active July 9, 2018 06:42
Run docker inside Jenkins

Create a Dockerfile with the following contents

FROM jenkins:2.32.3

USER root
RUN apt-get -qq update \
   && apt-get -qq -y install \
 curl