Skip to content

Instantly share code, notes, and snippets.

View gptshubham595's full-sized avatar
:octocat:
Sorry, Important ones are Private.

Shubham Kumar Gupta gptshubham595

:octocat:
Sorry, Important ones are Private.
View GitHub Profile
Feature Traditional Android (R) KMP Compose (Res)
Location src/main/res/ src/commonMain/composeResources/
Access in Code R.string.title Res.string.title
Usage context.getString(R.string.title) stringResource(Res.string.title)
Underlying Type An int ID generated by AGP. A type-safe object accessor from the Compose resource library.
#!/bin/bash
progname="${0##*/}"
progname="${progname%.sh}"
# usage: check_elf_alignment.sh [path to *.so files|path to *.apk]
cleanup_trap() {
if [ -n "${tmp}" -a -d "${tmp}" ]; then
rm -rf ${tmp}
fi
object LocaleHelper {
fun setLocale(context: Context, languageCode: String) {
val appLocale: LocaleListCompat = LocaleListCompat.forLanguageTags(languageCode)
AppCompatDelegate.setApplicationLocales(appLocale)
val sharedPref = context.getSharedPreferences("Settings", Context.MODE_PRIVATE)
sharedPref.edit(commit = true) {
putString("language", languageCode)
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>WebSocket Chat Client</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 40px;
}
const WebSocket = require('ws');
const wss = new WebSocket.Server({ port: 8080 });
// roomId = Set of WebSocket connections
const rooms = new Map();
wss.on('connection', (socket, req) => {
// For demo, grab roomId from a query param ?room=room1
const url = new URL(req.url, 'http://localhost');
const roomId = url.searchParams.get('room') || 'lobby';
Scenario Service Time Service Rate (µ) Servers (N) Utilization (ρ) Stable
Original 10 ns 6,000,000,000 reqs/min 1 0.0000033 ~0%
Proposed 10 ms 6,000 reqs/min 4 0.833 = 83.3% ⚠️
Critical 20 ms 3,000 reqs/min 4 1.67 = 167%
Critical 20 ms 3,000 reqs/min 7 0.95 = 95% ⚠️
@gptshubham595
gptshubham595 / AudioPitch.kt
Last active May 7, 2023 21:57
Change pitch android
import java.lang.Math.cos
import kotlin.math.cos
import kotlin.math.floor
import kotlin.math.roundToInt
object AudioPitch {
//region Private Static Memebers
private const val MAX_FRAME_LENGTH = 8192
private const val M_PI = 3.14159265358979323846
google dork -> site:.co.uk inurl:"responsible disclosure"
https://registry.internetnz.nz/about/vulnerability-disclosure-policy/
http://www.123contactform.com/security-acknowledgements.htm
https://18f.gsa.gov/vulnerability-disclosure-policy/
https://support.1password.com/security-assessments/
https://www.23andme.com/security-report/
https://www.abnamro.com/en/footer/responsible-disclosure.html
https://www.accenture.com/us-en/company-accenture-responsible-disclosure
https://www.accredible.com/white_hat/
https://www.acquia.com/how-report-security-issue
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File sharing Azure</title>
</head>
<body>
<!--
@gptshubham595
gptshubham595 / HTTPTrigger1.js
Last active January 26, 2022 19:02
Azure Storage Portal Function
const {
Aborter,
BlobURL,
BlockBlobURL,
BlobServiceClient,
ContainerURL,
ServiceURL,
StorageURL,
SharedKeyCredential,
AnonymousCredential,