Skip to content

Instantly share code, notes, and snippets.

View championswimmer's full-sized avatar

Arnav Gupta championswimmer

View GitHub Profile
@championswimmer
championswimmer / commands.sh
Created June 20, 2023 17:31
Useful Commands
# Download portion of video
yt-dlp -4 -f "mp4" -S "res:1080" --write-thumbnail --download-section "*30:52-31:54" "https://www.youtube.com/watch?v=8Kazdjpf7oI"
# Download Twitter Thread
ttm -f -t -q -a --assets-path images -p posts --filename mobile-app-pms-india-2023 https://twitter.com/championswimmer/status/1622946183881564160
# Speed up a video
ffmpeg -i trainer.mp4 -filter:v "setpts=1/1.1*PTS" -filter:a "atempo=1.1" trailer.mp4
@championswimmer
championswimmer / ascii
Last active June 3, 2022 13:17
refactor-intro-code
██████╗░███████╗███████╗░█████╗░░█████╗░████████╗░█████╗░██████╗░
██╔══██╗██╔════╝██╔════╝██╔══██╗██╔══██╗╚══██╔══╝██╔══██╗██╔══██╗
██████╔╝█████╗░░█████╗░░███████║██║░░╚═╝░░░██║░░░██║░░██║██████╔╝
██╔══██╗██╔══╝░░██╔══╝░░██╔══██║██║░░██╗░░░██║░░░██║░░██║██╔══██╗
██║░░██║███████╗██║░░░░░██║░░██║╚█████╔╝░░░██║░░░╚█████╔╝██║░░██║
╚═╝░░╚═╝╚══════╝╚═╝░░░░░╚═╝░░╚═╝░╚════╝░░░░╚═╝░░░░╚════╝░╚═╝░░╚═╝
@championswimmer
championswimmer / AsyncTaskExample.java
Created December 17, 2021 05:58
AsyncTaskExample.java
class MyTask extends AsyncTask {
void onPreTask() {
// step 1: this runs on main thread
}
void onTastExecute() {
// step 2: this runs on a separate background thread
@championswimmer
championswimmer / runtime-annotation-kotlin.md
Last active July 29, 2023 12:50
Runtime @annotation Processing using Reflection in Kotlin

Runtime @Annotation Processing using Reflection in Kotlin

Let us take a look at Annotations in Kotlin, and start with a simple example of processing annotations at runtime using JVM's reflection framework.

NOTE: This is shown in Kotlin, but is specific to how Kotlin/JVM works, and is not applicable to Kotlin/JS or Kotlin/Native.

Creating an Annotation

First of all, we create annotations in Kotlin using the keywords annotation class.

@championswimmer
championswimmer / MainActivity.kt
Created August 4, 2019 18:22
Android Async Handler Difference
package com.codingblocks.handlerasync
import android.annotation.SuppressLint
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
@championswimmer
championswimmer / MainActivity.kt
Created August 4, 2019 18:22
Android Async Handler Difference
package com.codingblocks.handlerasync
import android.annotation.SuppressLint
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
const express = require('express')
const app = express()
let todos = []
app.use(express.json())
app.use(express.urlencoded({extended: true}))
app.get('/todos', (req, res) => {
@championswimmer
championswimmer / index.html
Created October 3, 2018 11:31
IEEE NSIT Game Dev Workshop 2018
<html>
<!-- Mozilla Developer Network (mdn) -->
<!-- Upload to app.netlify.com/drop -->
<!-- Submit to ieeensitdu@gmail.com -->
<!-- Subject: IEEE Game Dev Assignment -->
<head>
<style>
#game {
height: 400px;
@championswimmer
championswimmer / idea.sh
Created August 22, 2018 19:25
IntelliJ IDEA Launch Script (MacOS)
#!/bin/sh
ARG=$@
if [ "$ARG" == "." ]
then
ARG=$(pwd)
fi
echo "Opening IntelliJ IDEA with args = ${ARG}"
open -a "IntelliJ IDEA" --args $ARG
@championswimmer
championswimmer / logcat.txt
Created August 3, 2018 20:07
boot logcat
--------- beginning of system
01-06 17:57:36.324 779 779 E LockSettingsStorage: Cannot read file java.io.FileNotFoundException: /data/system/password.key: open failed: ENOENT (No such file or directory)
01-06 17:57:36.325 779 779 E LockSettingsStorage: Cannot read file java.io.FileNotFoundException: /data/system/gatekeeper.pattern.key: open failed: ENOENT (No such file or directory)
01-06 17:57:36.327 779 779 E LockSettingsStorage: Cannot read file java.io.FileNotFoundException: /data/system/gatekeeper.gesture.key: open failed: ENOENT (No such file or directory)
01-06 17:57:36.327 779 779 E LockSettingsStorage: Cannot read file java.io.FileNotFoundException: /data/system/gesture.key: open failed: ENOENT (No such file or directory)
01-06 17:57:36.331 779 779 D SystemServerTiming: MakeLockSettingsServiceReady took to complete: 104ms
01-06 17:57:36.331 779 779 I SystemServer: StartBootPhaseLockSettingsReady
01-06 17:57:36.331 779 779 I SystemServiceManager: Starting phase 480
01-06 17