This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Courtesy: Perplexity.AI | |
# | |
import json | |
from openai import OpenAI | |
class AutoMCPClient: | |
def __init__(self, api_key, model="gpt-4-0613"): | |
self.client = OpenAI(api_key=api_key) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const url = require('url'); | |
// Parse command-line arguments | |
const args = process.argv.slice(2); | |
const baseDirectory = args[0] || '.'; // Default to current directory | |
const portArg = args.find(arg => arg.startsWith('--port=')); | |
const delayArg = args.find(arg => arg.startsWith('--delay=')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Typical additions on top of the Android Studio Jetpack Compose template. | |
Root gradle | |
=========== | |
plugins { | |
id("com.google.dagger.hilt.android") version "2.51.1" apply false | |
} | |
Module gradle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export firebase firestore to json | |
npx -p node-firestore-import-export firestore-export -a credentials.json -b backup.json | |
# Import firebase firestore from json | |
npx -p node-firestore-import-export firestore-import -a credentials.json -b backup.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: watermark.sh <pdf file name without extension> | |
# | |
magick $1.pdf \ | |
-gravity Center \ | |
-pointsize 40 \ | |
-fill 'rgba(169, 169, 169, 0.5)' \ | |
-draw "rotate -45 text 0,0 'SAMPLE WATERMARK'" \ | |
-alpha on -background none -compose over \ | |
$1-WM.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
video -> gif: | |
ffmpeg -i ripplefix.mp4 -pix_fmt rgb8 -r 10 output.gif && gifsicle -O3 output.gif -o output.gif | |
mongodb | |
======= | |
mongoexport --uri="mongodb://localhost:27017/your_database" --collection=challenges --out=challenges.json --jsonArray | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Multiple git accounts | |
config: | |
Host bitbucket.org | |
Hostname bitbucket.org | |
IdentityFile ~/.ssh/id_bb | |
Host github.com-personal | |
Hostname github.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Increase adb buffer size | |
======================== | |
adb logcat -b main -G 16M | |
adb logcat -g | |
Decode obfuscated trace | |
======================= | |
~/Library/Android/sdk/tools/proguard/bin/retrace.sh proguard.map <stacktracefile> | |
Doze mode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'com.android.library' | |
id 'maven-publish' | |
} | |
group = "com.example" | |
version = "1.0.0" | |
android { | |
namespace 'com.example.lib0' | |
compileSdk 32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.text.format.DateUtils | |
fun getDurationString(secondsElapsed: Long): String { | |
val hours = secondsElapsed / 3600 | |
val minutes = (secondsElapsed % 3600) / 60 | |
val seconds = secondsElapsed % 60 | |
return if (hours > 0) | |
String.format("%02d:%02d:%02d", hours, minutes, seconds) | |
else | |
String.format("%02d:%02d", minutes, seconds) |