Skip to content

Instantly share code, notes, and snippets.

View umanghome's full-sized avatar
👨‍💻

Umang Galaiya umanghome

👨‍💻
View GitHub Profile
import java.util.*;
public class Permutations {
public static void main (String args[]) {
// Check usage
if (args.length < 1) {
System.out.println("Usage: java Permutations [word]");
return;
@umanghome
umanghome / Apriori.java
Created October 17, 2016 17:00
Apriori implementation in Java.
import java.util.*;
public class Apriori {
public static void main (String args[]) {
// Get input
Scanner terminal = new Scanner(System.in);
System.out.print("Number of transactions: ");
int numberOfTransactions = Integer.parseInt(terminal.nextLine());
@umanghome
umanghome / Apriori.java
Last active October 17, 2016 17:42
Improved Apriori using Transaction Reduction, implemented in Java.
import java.util.*;
public class Apriori {
public static void main (String args[]) {
// Get input
Scanner terminal = new Scanner(System.in);
System.out.print("Number of transactions: ");
int numberOfTransactions = Integer.parseInt(terminal.nextLine());
@umanghome
umanghome / input.txt
Created October 19, 2016 04:11
Input for Apriori program
9
I1 I2 I5
I2 I4
I2 I3
I1 I2 I4
I1 I3
I2 I3
I1 I3
I1 I2 I3 I5
I1 I2 I3
@umanghome
umanghome / mail.php
Created April 1, 2018 17:54
Sending Elastic Email emails using PHP
<?php
define('ELASTIC_MAIL_API_KEY', '');
/**
* Sends an email using Elastic Mail.
* @param {String} $to Receiver's email address.
* @param {String} $subject Email submit.
* @param {String} $body_text Text body.
* @param {String} $body_html HTML body.
@umanghome
umanghome / publish.yml
Last active November 7, 2024 11:20
GitHub Action: Generate a build and push to another branch
# .github/workflows/publish.yml
name: Generate a build and push to another branch
on:
push:
branches:
- master # Remove this line if your primary branch is "main"
- main # Remove this line if your primary branch is "master"
jobs:
@umanghome
umanghome / webshare.js
Created October 17, 2020 21:38
Basic WebShare API Code
function showElement(element) {
element.classList.remove('hidden');
}
function sharePage() {
const share = {
text: document.querySelector('title').innerText,
url: window.location.href,
};
@umanghome
umanghome / index.js
Last active April 27, 2021 20:10
Did CoWIN deploy JS yet?
/**
* This could probably be done in like three lines of shell script
* but I have no idea how to write those.
*
* run `npm init -y`
* run `npm i node-fetch jsdom`
* run `node index.js`
* turn Slack notifications on
* and go to bed.
*
@umanghome
umanghome / index.js
Created April 29, 2021 09:29
Do we have vaccination slots for 25 year olds yet?
/**
* run `npm init -y`
* run `npm i node-fetch`
* run `node index.js`
* turn Slack notifications on
*
* Get cowinUrl from the DevTools' network tab
* Get authorization string from the Request Headers as the value of authorization header of the network request for cowinUrl. If this expires, the script will stop working. You'll have to log in again and get a new value for this.
*/
@umanghome
umanghome / webcrypto.js
Created July 27, 2021 07:13
WebCrypto encrypt/decrypt
const ENCRYPT_PASSWORD = 'SEbSk7s9AxpUDiPgljlmYpRvr3yNVurYqmBm82swjhU';
let encryptionKey;
async function getEncryptionKey() {
if (encryptionKey) {
return encryptionKey;
}
const exported = {
alg: 'A256GCM',