Skip to content

Instantly share code, notes, and snippets.

View mythz's full-sized avatar

Demis Bellot mythz

View GitHub Profile
@mythz
mythz / ffmpeg.py
Created August 24, 2024 02:01
ffmpeg-api
import aiohttp
from aiohttp import web
import asyncio
import os
import tempfile
import uuid
# Ensure ffmpeg is installed and accessible in your system PATH
routes = web.RouteTableDef()
@mythz
mythz / keybase.md
Created February 16, 2021 08:40
keybase.md

Keybase proof

I hereby claim:

  • I am mythz on github.
  • I am mythz (https://keybase.io/mythz) on keybase.
  • I have a public key ASAeJidstT7bc7YfiJpDh_XTzcEFOsssBSa-CfwM_aQJlwo

To claim this, I am signing this object:

@mythz
mythz / vanilla.js
Last active March 4, 2021 14:56
3 missing JS functions
let $ = (sel, el) => typeof sel === "string" ? (el || document).querySelector(sel) : sel || null,
$$ = (sel, el) => Array.prototype.slice.call((el || document).querySelectorAll(sel));
function on(sel, handlers) {
$$(sel).forEach(e => {
Object.keys(handlers).forEach(function (evt) {
let fn = handlers[evt];
if (typeof evt === 'string' && typeof fn === 'function') {
e.addEventListener(evt, fn.bind(e));
}
@mythz
mythz / main.cs
Last active December 2, 2020 06:45
Custom SQL Issue
using System;
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
var db = dbFactory.Open(); // Open ADO.NET DB Connection
@mythz
mythz / main.cs
Last active November 23, 2020 09:09
Ensures with Dynamic SqlExpression Example
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
var db = dbFactory.Open(); // Open ADO.NET DB Connection
OrmLiteUtils.PrintSql(); // view generated SQL
OrmLiteConfig.StripUpperInLike = true; // comment to force insensitive like comparisons
@mythz
mythz / main.cs
Created October 19, 2020 07:14
Create new JWT Auth Key
var base64Key = System.Convert.ToBase64String(ServiceStack.AesUtils.CreateKey());
System.Console.WriteLine(base64Key);
@mythz
mythz / main.cs
Created July 1, 2020 13:47 — forked from alfredoPacheco/main.cs
Redis Redis/Memory RemoveAll repro
using System;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.Redis;
using ServiceStack.DataAnnotations;
using ServiceStack.Caching;
var redisManager = new RedisManagerPool("localhost:6379");
var redis = redisManager.GetClient();
redis.FlushAll();
@mythz
mythz / main.cs
Last active June 29, 2020 19:52
Redis RemoveAll repro
using System;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.Redis;
using ServiceStack.DataAnnotations;
var redisManager = new RedisManagerPool("localhost:6379");
var redis = redisManager.GetClient();
redis.FlushAll();
@mythz
mythz / main.cs
Created May 14, 2020 17:57
Using custom Guid in JSON
using System;
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
JsConfig<Guid>.SerializeFn = guid => guid.ToString();
public partial class Dto
{
public Guid Guid { get; set; } = Guid.NewGuid();
@mythz
mythz / main.cs
Created March 28, 2020 04:25 — forked from gistlyn/main.cs
OrmLite runtime attributes
using System;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
OrmLiteUtils.PrintSql();
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);