Skip to content

Instantly share code, notes, and snippets.

View adityak74's full-sized avatar
🏋️‍♂️
hustling

Aditya Karnam adityak74

🏋️‍♂️
hustling
View GitHub Profile
@adityak74
adityak74 / scrape_youtube_trending_videos.py
Last active March 8, 2022 02:56
Scrape Youtube Trending Videos
@adityak74
adityak74 / sortArticles.js
Created November 8, 2021 17:17
Sort Articles by Comments and Alphabetic Hackerrank Solution
/*
* Complete the 'topArticles' function below.
*
* The function is expected to return a STRING_ARRAY.
* The function accepts INTEGER limit as parameter.
* base url for copy/paste:
* https://jsonmock.hackerrank.com/api/articles?page=<pageNumber>
*/
const https = require('https');
const makeRequest = (pageNumber = 1) => new Promise((resolve, reject) => {
@adityak74
adityak74 / mincost.js
Created November 8, 2021 17:13
Find minimum cost DP problem Hackerrank
function calculateAmount(prices) {
let dp = [];
dp[0] = prices[0];
let totalCost = prices[0];
for (let i = 1; i < prices.length; i += 1) {
if (prices[i] - dp[i-1] < 0) {
totalCost += 0;
dp[i] = Math.min(prices[i], dp[i-1]);
}
else {
@adityak74
adityak74 / helloworld.fe
Created November 1, 2021 02:39
Ethereum Fe Smart Contract Hello World Message
# The `contract` keyword defines a new contract type
contract HelloWorld:
message: String<100>
pub fn __init__(self, _message: String<100>):
self.message = _message
pub fn update(self, newMessage: String<100>):
self.message = newMessage
pub fn getMessage(self) -> String<100>:
return self.message.to_mem()
@adityak74
adityak74 / artifacts...HelloWorld.json
Created November 1, 2021 02:08
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
@adityak74
adityak74 / merge-all-pull-request.js
Last active September 2, 2021 15:10
Octokit Script to Merge all PRs at once
const { Octokit } = require("octokit");
const dotenv = require('dotenv');
const path = require('path');
// to load the PAT you created
dotenv.config({ path: path.join(__dirname, '..', '..', `.env.${process.env.NODE_ENV || 'development'}`) });
// Create a personal access token at https://github.com/settings/tokens/new?scopes=repo
const octokit = new Octokit({ auth: process.env.GIT_PAT });