Skip to content

Instantly share code, notes, and snippets.

View siddhantkushwaha's full-sized avatar
🏠
Working from home

Siddhant Kushwaha siddhantkushwaha

🏠
Working from home
  • India
View GitHub Profile
@siddhantkushwaha
siddhantkushwaha / split.cpp
Created September 8, 2022 17:33
Quick C++ utility functions.
vector<string> split(const string& input, const char& ch) {
vector<string> tokens;
string token;
istringstream stream(input);
while(getline(stream, token, ch)) {
tokens.push_back(token);
}
return tokens;
}
@siddhantkushwaha
siddhantkushwaha / create_credentials.md
Created May 13, 2022 07:35
Steps to build credentials JSON for Google APIS.

Follow these steps to build credentials JSON

  1. Go to https://console.cloud.google.com/projectcreate.
  2. Fill in Project Name, like "Sample-Project" or so, leave Location unchanged.
  3. Change Project ID (optional).
  4. Click "CREATE".
  5. Wait a couple of seconds until the project is created and open it (click "VIEW").
  6. On the APIs pane, click "Go to APIs overview".
  7. Click "ENABLE APIS AND SERVICES".
  8. Search for the API you need to enable.
@siddhantkushwaha
siddhantkushwaha / chain_reaction_bot.cpp
Created November 19, 2021 14:43
My bot for the chain reaction game.
/*
Chain reaction bot for Create 202
Author: Siddhant Kushwaha
*/
#include <iostream>
#include <string>
#include <vector>
#include <stack>
@siddhantkushwaha
siddhantkushwaha / client.js
Created July 3, 2021 03:07
Socket server and client in node js.
const net = require('net');
const sendMessage = (port, message) => {
return new Promise((resolve, reject) => {
const client = net.createConnection(port, () => {
try {
console.log('Sending message', message)
const messageSerialized = JSON.stringify(message)
client.write(messageSerialized)
}
package com.siddhantkushwaha.falcon.activity
import android.os.Bundle
import com.google.android.gms.common.api.Scope
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.api.services.gmail.GmailScopes
import com.siddhantkushwaha.falcon.R
import kotlinx.android.synthetic.main.activity_home.*
package com.siddhantkushwaha.falcon.common
import android.app.Activity
import android.util.Log
import com.google.android.gms.auth.api.signin.GoogleSignIn
import com.google.android.gms.auth.api.signin.GoogleSignInClient
import com.google.android.gms.auth.api.signin.GoogleSignInOptions
import com.google.android.gms.common.api.ApiException
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.GoogleAuthProvider
import pickle
ckpt = '/content/drive/MyDrive/mydumps/ck1.pickle'
def load():
with open(ckpt, 'rb') as fp:
chk = pickle.load(fp)
return chk
def exists(key):
package com.siddhantkushwaha.carolyn.ml
import com.google.android.gms.tasks.Tasks
import com.google.mlkit.nl.languageid.LanguageIdentification
import kotlin.Exception
class LanguageId {
companion object {
@siddhantkushwaha
siddhantkushwaha / palladium.ipynb
Created August 14, 2020 14:43
Palladium.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@siddhantkushwaha
siddhantkushwaha / colab_palladium.py
Created August 14, 2020 14:41
Palladium setup on Colab.
import os
import json
from datetime import datetime
os.system('pip install --upgrade pip')
os.system('pip install palladium-python')
os.system('apt-get update')
os.system('apt install chromium-chromedriver')