Skip to content

Instantly share code, notes, and snippets.

@piyushbansal
piyushbansal / ValidateSSH.py
Last active October 6, 2023 14:15
A simple script to validate SSH keys.
#! /bin/bash/python
# Author : Piyush Bansal
# To check if a key is valid ssh key (rsa)
# REQUIREMENTS : give input a file , that has one ssh-key in it.
# RESULT : valid/not valid ssh-key
# NOTE : initial devel. phase, needs to to tweaked to make it suitable for our use here.
import base64,struct,sys,binascii
n=input()
for i in range(0,n):
string = raw_input()
print ("YES","NO")[(sorted(string[:len(string)/2])!=sorted(string[len(string)/2+(len(string)%2):]))]
@piyushbansal
piyushbansal / acceptance_datastore_manipulations.py
Last active December 22, 2015 14:18
gci_student_register_required_inputs.acc
def GSoCStudentRegistrationDataSeeding():
program_helper = program_utils.GSoCProgramHelper()
sponsor = program_helper.createSponsor()
gsoc = program_helper.createProgram(override={'name':'Google Summer of Code',
'short_name':'gsoc new'})
org_app = program_helper.createOrgApp()
timeline = timeline_utils.GSoCTimelineHelper(gsoc.timeline, org_app)
timeline.studentSignup()
site = program_helper.createSite()
# There are basically two functions in this gist. The first function
# get_covariance_matrix is basically a helper function.
# The other one get_mutual_information_based_best_sample is the one that is used as sampling
# strategy.
def get_covariance_matrix(matrix_a, matrix_b):
"""Takes two matrices (2 dimensional arrays) and returns covariance matrix."""
cov_matrix = []
for i,elements_a in enumerate(matrix_a):