Skip to content

Instantly share code, notes, and snippets.

View maail's full-sized avatar

Mohamed Maail maail

View GitHub Profile
@maail
maail / transcribe_audio.py
Created June 12, 2023 04:57
Transcribe Large Audio Files with Whisper
#requires ffmpeg to be installed
import os
from tempfile import NamedTemporaryFile
import subprocess
import math
import openai
async def _transcribe_audio(audio_file):
openai.api_key = OPEN_API_KEY
@maail
maail / onDocumentCreate.js
Last active June 6, 2020 04:24
On document create Telegram
/// on post created
exports.documentCreate = functions.firestore
.document('document/{documentId}')
.onCreate((change, context) => {
bot.telegram.sendMessage(functions.config().bot.chat, '📄 New post created')
});
@maail
maail / onUserCreate.js
Created June 6, 2020 04:23
On user create telegram
exports.onUserCreate = functions.auth.user().onCreate((user) => {
bot.telegram.sendMessage(functions.config().bot.chat, '🎉 New user joined')
});
@maail
maail / index.js
Created June 6, 2020 04:19
index.js top
const functions = require('firebase-functions')
const { Telegraf } = require('telegraf')
const bot = new Telegraf(functions.config().bot.token)
@maail
maail / onDocumentCreate.js
Last active June 6, 2020 04:23
onDocumentCreate
/// on post created
exports.documentCreate = functions.firestore
.document('document/{documentId}')
.onCreate((change, context) => {
console.log("Document created")
});
@maail
maail / onUserCreate.js
Last active June 6, 2020 04:22
User Create Trigger
exports.onUserCreate = functions.auth.user().onCreate((user) => {
console.log("User created")
});
@maail
maail / NewEpisodes.json
Created February 13, 2020 03:17
New Episodes
{
"data": {
"media": [
{
"type": "course",
"title": "Conscious Parenting",
"coverAsset": {
"url": "https://assets.mindvalley.com/api/v1/assets/5bdbdd0e-3bd3-432b-b8cb-3d3556c58c94.jpg?transform=w_1080"
},
"channel": {
@maail
maail / gist:85ac40c56ddb58084d3a389bafa0c7d4
Created June 27, 2016 09:04
Find fonts available in Xcode Project
func getFontsAvailable(){
var fontFamilies = UIFont.familyNames()
for index in 0..<fontFamilies.count{
let fontFamily = fontFamilies[index]
let fontNames: NSArray = UIFont.fontNamesForFamilyName(fontFamilies[index] as String) as NSArray
print("\(fontFamily), \(fontNames)")
}
}
@maail
maail / Separator Insets to Zero iOS8 Swift
Created September 30, 2014 12:03
Set UITableViews Separator Insets to Zero in iOS8
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
if(self.tableView.respondsToSelector(Selector("setSeparatorInset:"))){
self.tableView.separatorInset = UIEdgeInsetsZero
}
if(self.tableView.respondsToSelector(Selector("setLayoutMargins:"))){
self.tableView.layoutMargins = UIEdgeInsetsZero
}
if(cell.respondsToSelector(Selector("setLayoutMargins:"))){