Skip to content

Instantly share code, notes, and snippets.

View algomaster99's full-sized avatar
🔒
Securing software supply chains

Aman Sharma algomaster99

🔒
Securing software supply chains
View GitHub Profile
@algomaster99
algomaster99 / HashMap.java
Created May 23, 2021 18:22
Couldn't we do without `equals`? I think only `hashCode` is sufficient.
package com.diffmin;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class TestMain {
public static void main(String args[]) {
HashMapImpl newHashMap = new HashMapImpl();
newHashMap.add(4, "a"); // [4: a]
@algomaster99
algomaster99 / ParaBodyBreak.WORD.yaml
Last active July 17, 2020 10:18
Insertion of LineBreak is automatic for the first Heading
name: ParaBodyBreak
description: Insertion of LineBreak is automatic for the first Heading
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function insertHeading() {
await Word.run(async context => {
@algomaster99
algomaster99 / CustomXML.WORD.yaml
Created July 6, 2020 20:25
Create a new snippet from a blank template.
name: CustomXML
description: Create a new snippet from a blank template.
host: WORD
api_set: {}
script:
content: |
$("#add-xml").click(() => tryCatch(run));
$("#get-node").click(() => tryCatch(getNode));
$("#delete-xml").click(() => tryCatch(deleteXml));
@algomaster99
algomaster99 / CustomXML.WORD.yaml
Last active July 6, 2020 20:07
Create a new snippet from a blank template.
name: CustomXML
description: Create a new snippet from a blank template.
host: WORD
api_set: {}
script:
content: |
$("#add-xml").click(() => tryCatch(run));
$("#get-node").click(() => tryCatch(getNode));
$("#delete-xml").click(() => tryCatch(deleteXml));
@algomaster99
algomaster99 / all-paths.cc
Created June 3, 2020 14:40
CSES Book "Pruning the search"
#include<bits/stdc++.h>
using namespace std;
#define en cout<<"\n";
#define ll long long
auto clk = clock();
ll n;
ll ans = 0;
@algomaster99
algomaster99 / spec.json
Created May 27, 2020 19:30
Vega-Lite spec from Thu May 28 2020
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"description": "Plot showing a 30 day rolling average with raw values in the background.",
"width": 400,
"height": 300,
"data": {"url": "data/seattle-weather.csv"},
"transform": [{
"frame": [-15, 15],
"window": [
{
@algomaster99
algomaster99 / ws_client.php
Created May 16, 2020 15:51
Websocket Client in PHP
<?php
namespace common\components;
class WebSocketClient {
private $_Socket = null;
public function __construct($host, $port) {
$this->_connect($host, $port);
@algomaster99
algomaster99 / doomsday_fuel.py
Created April 24, 2020 11:34
Solution to Doomsday Fuel foobar challenge
from fractions import Fraction
# Replace trials by probabilties of occurrences
def replace_probability(m):
for row in range(len(m)):
total = 0
for item in range(len(m[row])):
total += m[row][item]
if total != 0:
for item in range(len(m[row])):
@algomaster99
algomaster99 / GSOC19.md
Last active August 23, 2019 15:20
Google Summer of Code 2019 - Final Evaluation

Google Summer of Code 2019 - Final Submission

For the last three months, I’ve been working with Vega, an open source organisation selected for the Google Summer of Code program. It has been an amazing experience and I’ve learnt a lot over the summer under the mentorship of Dominik Moritz.

This gists contains information of all the work I have accomplished in 3 months. The back-end service, for vega-editor, was set-up from scratch and deployed on https://vega.now.sh/. Around 60 commits and 10,000+ additions were created.

About the project

The project is a platform for hosting Vega and Vega-Lite visualizations. It is collection of few API endpoints which enables a user to authenticate via GitHub and display a list of Vega and Vega-Lite compatible gists. The user can further load this gist in the editor since both of the projects have been integrated.

@algomaster99
algomaster99 / key_generation.py
Created December 15, 2018 15:35
Key generation using RSA algorithm
def gen_key():
private_key = rsa.generate_private_key(
public_exponent=65537, key_size=2048, backend=default_backend()
)
return private_key
def encode_private_key(pk):
pem = pk.private_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.TraditionalOpenSSL,