Skip to content

Instantly share code, notes, and snippets.

View raxityo's full-sized avatar
👋

Raxit Majithiya raxityo

👋
View GitHub Profile
@raxityo
raxityo / adsense-calculator-data.json
Last active April 9, 2024 13:42
Raw data used by Google AdSense reveue calculator (don't trust the actual numbers, but you can use this as a reference)
[
{
"category": "News",
"multiplier": "0.97",
"region": "South America"
},
{
"category": "Sports",
"multiplier": "1.74",
"region": "South America"
@raxityo
raxityo / mastodon_client.sh
Created February 21, 2024 15:17
Example implementation of a Mastodon API client
if [ -z $OAUTH_TOKEN ]
then
if [ -z $CLIENT_ID ]
then
APP_INFO=$(curl -s -X POST \
-F 'client_name=Example App' \
-F 'redirect_uris=urn:ietf:wg:oauth:2.0:oob' \
-F 'scopes=read' \
-F 'website=https://example.com' \
@raxityo
raxityo / DrawSparkline.js
Last active July 10, 2023 14:54
Draw Sparkline chart, converted by ChatGPT from https://alexplescan.com/posts/2023/07/08/easy-svg-sparklines/
// Define the default fill and stroke colors
const defaultFill = "#dcfce7";
const defaultStroke = "#bbf7d0";
// Define the stroke width
const strokeWidth = 4;
/**
* Draws a sparkline SVG based on the given width, height and points
* @param {number} width - The width of the SVG element
@raxityo
raxityo / generate_math_equations.js
Created July 5, 2023 18:57
A NodeJS script to generate math equations to submit evals for ChatGPT. Used by https://github.com/openai/evals/pull/1269.
const template = {
input: [
{
role: "system",
content:
"You are a skilled mathematician capable of solving math equations. Walk through the answer. Solve the equations with only the numerical answer rounded to 4 decimal places. Include the answer in square brackets []. Do not include comma in the answer."
},
{
role: "user",
content: "<TO_BE_FILLED>"
@raxityo
raxityo / Bing_Temper.js
Last active August 6, 2023 03:14
Tweaks on Bing Chat
// ==UserScript==
// @name Bing Tamper
// @namespace Violentmonkey Scripts
// @match https://www.bing.com/search
// @grant none
// @version 1.0
// @author -
// @description 3/17/2023, 11:59:35 AM
// ==/UserScript==
function prettyCookie() {
const cc = document.cookie.split(';').map(c => {
const [k, ...v] = c.split('=')
let vv = decodeURIComponent(v.join('='))
try {
vv = JSON.parse(vv)
} catch {}
return { [`${decodeURIComponent(k.trim())}`]: vv }
})
return Object.assign({}, ...cc)
@raxityo
raxityo / BJs_clipAllOffers.js
Last active March 27, 2024 13:59
Clip all available BJ's coupons
// ==UserScript==
// @name BJ's Coupon Clipper
// @namespace Violentmonkey Scripts
// @match https://www.bjs.com/
// @grant none
// @version 1.0
// @author @raxityo
// @description 3/24/2024, 11:01:30 PM
// ==/UserScript==
@raxityo
raxityo / redis-session-store.ts
Created July 6, 2022 16:20
An example implementation of session-less redis store that can be used with `passport-oauth1` and any strategies that depend on oauth1, such as passport-twitter
/**
* ©️ Copyright 2022 Raxit Majithiya https://github.com/raxityo
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT O
/**
* Execute a callback on the main scope after given delay.
*
* @param timeMillis delay in milliseconds
* @param callback callback to execute after the delay
*/
fun View.lifecycleAwarePostDelayed(timeMillis: Long, callback: () -> Unit) {
findViewTreeLifecycleOwner()?.lifecycle?.coroutineScope?.launch(Dispatchers.Main) {
delay(timeMillis)
callback()
@raxityo
raxityo / youtube_format_code_itag_list.md
Created July 17, 2021 22:20 — forked from sidneys/youtube_format_code_itag_list.md
YouTube video stream format codes itags

YouTube video stream format codes

Comprehensive list of YouTube format code itags

itag Code Container Content Resolution Bitrate Range VR / 3D
5 flv audio/video 240p - - -
6 flv audio/video 270p - - -
17 3gp audio/video 144p - - -
18 mp4 audio/video 360p - - -
22 mp4 audio/video 720p - - -