Skip to content

Instantly share code, notes, and snippets.

View supunsandeeptha's full-sized avatar
🎯
Focusing

Supun Sandeeptha supunsandeeptha

🎯
Focusing
View GitHub Profile
@supunsandeeptha
supunsandeeptha / createSelfSignedCert.js
Created July 18, 2022 07:17 — forked from JensWalter/createSelfSignedCert.js
generate a self signed certificate with AWS Lambda
const exec = require('child_process').exec;
const fs = require("fs");
exports.handler = function(event, context) {
console.log("creating certificate");
exec('openssl req -x509 -newkey rsa:4096 -keyout /tmp/key.pem -out /tmp/cert.pem -subj "/C=DE/ST=Bavaria/L=Munich/O=apimeister org/OU=org unit/CN=apimeister.com" -days 45 -nodes', (error, stdout, stderr) => {
if (error) {
throw error;
}
console.log("reading certificate");
@supunsandeeptha
supunsandeeptha / git.migrate
Created November 12, 2021 03:54 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@supunsandeeptha
supunsandeeptha / Windows10AWSEC2.md
Created July 22, 2021 03:56 — forked from peterforgacs/Windows10AWSEC2.md
Running Windows 10 on AWS EC2

Running Windows 10 on AWS EC2

Downloading the image

Download the windows image you want.

AWS vmimport supported versions: Microsoft Windows 10 (Professional, Enterprise, Education) (US English) (64-bit only)

So Home wont work.

@supunsandeeptha
supunsandeeptha / gist:7f5d565107a73f2673122cbe7784d4a9
Created June 23, 2021 05:40 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.
# These owners will be the default owners for everything in the repo.
* @defunkt
# Order is important. The last matching pattern has the most precedence.
# So if a pull request only touches javascript files, only these owners
# will be requested to review.
*.js @octocat @github/js
@supunsandeeptha
supunsandeeptha / Jenkinsfile
Created May 18, 2021 08:14 — forked from JCotton1123/Jenkinsfile
Sample Jenkinsfile for Python project
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '10')) // Retain history on the last 10 builds
ansiColor('xterm') // Enable colors in terminal
timestamps() // Append timestamps to each line
timeout(time: 20, unit: 'MINUTES') // Set a timeout on the total execution time of the job
}
agent {
// Run this job within a Docker container built using Dockerfile.build
// contained within your projects repository. This image should include
@supunsandeeptha
supunsandeeptha / python27_on_debian.sh
Created January 25, 2021 03:46 — forked from lukaslundgren/python27_on_debian.sh
How to install python 2.7 on debian
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev libdb-dev
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -xzf Python-2.7.3.tgz
cd Python-2.7.3
./configure --prefix=/usr --enable-shared
make
sudo make install
cd ..
wget https://dist.opendnssec.org/source/softhsm-2.3.0.tar.gz
tar -xzf softhsm-2.3.0.tar.gz
./configure
./configure --help
make
make install
softhsm2-util --init-token --slot 0 --label "Token-1"
import java.security.*;
import sun.security.pkcs11.*;
import javax.crypto.*;
import javax.crypto.spec.SecretKeySpec;
public class SoftHSM {
public static void main(String[] args) throws Exception {
name = SoftHSM
library = /usr/local/lib/softhsm/libsofthsm2.so
slot = 1426856870
attributes(generate, *, *) = {
CKA_TOKEN = true
}
attributes(generate, CKO_CERTIFICATE, *) = {
CKA_PRIVATE = false
}
attributes(generate, CKO_PUBLIC_KEY, *) = {