Skip to content

Instantly share code, notes, and snippets.

@imranansari
imranansari / microservices.adoc
Created December 14, 2020 07:09 — forked from kbastani/microservices.adoc
Using Graph Analysis to Design Microservice Architectures in the Cloud

Using Graph Analysis to Design Microservice Architectures in the Cloud

This interactive Neo4j graph tutorial covers how to use graph analysis to find software modules that are highly centralized, making good candidates to be decomposed into microservices.


@imranansari
imranansari / comprehend.go
Created July 23, 2020 19:40 — forked from brydavis/comprehend.go
Example of AWS Comprehend with Go
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/comprehend"
)
@imranansari
imranansari / jenkins-add-ssh-keypair-with-password-credential.groovy
Created December 11, 2019 04:14 — forked from ivan-pinatti/jenkins-add-ssh-keypair-with-password-credential.groovy
Jenkins - Add SSH keypair with password credential via groovy script - #jenkins #groovy #ssh #credential
#!groovy
// imports
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.Domain
import com.cloudbees.plugins.credentials.impl.*
import hudson.util.Secret
import java.nio.file.Files
#!/bin/bash
useradd -s /bin/bash -m unprivileged
cp -rf ~/.ssh ~unprivileged/
chown -R unprivileged:unprivileged ~unprivileged/.ssh/
@imranansari
imranansari / upspin-drive-guide.md
Created May 12, 2019 23:08 — forked from fstanis/upspin-drive-guide.md
Upspin server backed by Google Drive on a Raspberry Pi

Set up an Upspin server backed by Google Drive

Overview

The purpose of this document is to explain how to deploy an Upspin server on a Debian or Ubuntu based machine - which can be a Raspberry Pi - and, optionally, use Google Drive to back the data.

Effectively, this will give you all the nifty advantages Upspin gives you in terms of file sharing without requiring a costly server.

Requirements

@imranansari
imranansari / golang-tls.md
Created March 1, 2019 06:47 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@imranansari
imranansari / github.bash
Created January 17, 2019 00:38 — forked from igrigorik/github.bash
Open GitHub URL for current directory/repo...
alias gh="open \`git remote -v | grep git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"
@imranansari
imranansari / Jenkins_sudo_script
Created January 11, 2019 14:37 — forked from oleg-nenashev/Jenkins_sudo_script
Enables/Revokes administrative mode for users in Jenkins using Role-Strategy and Build User plugins.
import com.michelin.cio.hudson.plugins.rolestrategy.Role;
import com.michelin.cio.hudson.plugins.rolestrategy.RoleMap;
import com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy;
import jenkins.model.Jenkins;
import hudson.model.Result;
import hudson.EnvVars;
final String ROLE_PREFIX="sudo_";
EnvVars vars = build.getEnvironment(listener);
final String userName=vars .get("BUILD_USER_ID");
@imranansari
imranansari / ms-concepts-import.sh
Created December 31, 2018 22:17 — forked from jexp/ms-concepts-import.sh
Load and query the Microsoft Concept Graph in Neo4j https://concept.research.microsoft.com/Home/Introduction
function import_extract_first {
echo "name:ID(Concept)" > concepts.txt
cat data-concept-instance-relations.txt | cut -d $'\t' -f 1 | sort | uniq >> concepts.txt
echo "name:ID(Instance)" > instances.txt
cat data-concept-instance-relations.txt | cut -d $'\t' -f 2 | sort | uniq >> instances.txt
echo $':END_ID(Concept)\t:START_ID(Instance) relations:int' > is_a.hdr
$NEO4J_HOME/bin/neo4j-import --into concepts.db --id-type string --delimiter TAB --bad-tolerance 13000000 --skip-duplicate-nodes true --skip-bad-relationships true \
@imranansari
imranansari / find-ed25519.groovy
Created October 12, 2018 18:35 — forked from rtyler/find-ed25519.groovy
Determine whether there are passphrase-protected ed25519 keys in a Jenkins instance
import com.cloudbees.hudson.plugins.folder.*
import com.cloudbees.hudson.plugins.folder.properties.*
import com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider.FolderCredentialsProperty
import com.cloudbees.plugins.credentials.*
import com.cloudbees.jenkins.plugins.sshcredentials.SSHUserPrivateKey
/* Let's see if the key is ed25518 */
boolean checkKey(def key) {
boolean found = false