Skip to content

Instantly share code, notes, and snippets.

@kush-agra
kush-agra / Nothing_codenames.md
Created April 26, 2024 08:38
Nothing product code name sequence
Product Name Code Name Pokémon Intro Generation Evolution
Phone (1) Abra Gen 1 0
Phone (2) Alakazam Gen 1 2
Phone (2a) Aerodactyl Gen 1 0
Ear (1) Aipom Gen 2 0
Ear (2) Azumarill Gen 2 2
Ear (stick) Bellossom Gen 2 2
Ear Entei Gen 2 0
Ear (a) Cleffa Gen 2 0
@kush-agra
kush-agra / turnMusicIntoVibrate.js
Created January 30, 2023 21:23
Generate vibration from audio file
function turnMusicIntoVibrate(audioUrl) {
// Create an audio context
const audioContext = new AudioContext();
// Create an analyser node
const analyser = audioContext.createAnalyser();
analyser.fftSize = 8192;
// Load the audio file using fetch
fetch(audioUrl)
@kush-agra
kush-agra / makeApiCall.js
Created December 9, 2022 02:54
Make api call / call a function at a specified time approximately accurate to the millisecond
function makeApiCall(time) {
// Get the current date and time
var now = new Date();
// Set the date and time for the specified time
var specifiedTime = new Date();
specifiedTime.setHours(time.hours);
specifiedTime.setMinutes(time.minutes);
specifiedTime.setSeconds(0);
specifiedTime.setMilliseconds(0);
@kush-agra
kush-agra / play_binary_music.js
Last active December 4, 2022 21:17
Play a binary string as music in javascript
// Define the audio context
var audioContext = new AudioContext();
// Define the notes and their corresponding frequencies
var notes = {
'C': 16.35,
'C#': 17.32,
'D': 18.35,
'D#': 19.45,
'E': 20.60,
@kush-agra
kush-agra / amazon_order.py
Created December 4, 2022 18:32
Order things from amazon
# Import the necessary modules
import requests
import json
# Set your Amazon credentials
AMAZON_ACCESS_KEY = 'YOUR_ACCESS_KEY'
AMAZON_SECRET_KEY = 'YOUR_SECRET_KEY'
AMAZON_ASSOCIATE_TAG = 'YOUR_ASSOCIATE_TAG'
# Set the item you want to order
@kush-agra
kush-agra / makeApiCallAtSpecifiedTime.js
Created December 4, 2022 08:02
function that allows you to specify the time at which you want to make the API call
function makeApiCallAtSpecifiedTime(hour, minute) {
var date = new Date();
var currentHour = date.getHours();
var currentMinutes = date.getMinutes();
// check if it is currently past the specified time
if (currentHour > hour || (currentHour === hour && currentMinutes > minute)) {
// if it is past the specified time, call the API immediately
callApi();
} else {
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;