Skip to content

Instantly share code, notes, and snippets.

View robertohuertasm's full-sized avatar
🦀
friendly rustacean

Roberto Huertas robertohuertasm

🦀
friendly rustacean
View GitHub Profile
<script>
// we'll edit this later
let user;
</script>
<svelte:head>
<title>SvelteKit - Cognito</title>
</svelte:head>
{#if !user}
npm init svelte@next sveltekit-cognito-auth
# I'm choosing the Skeleton project,
# opting out of TypeScript for this tutorial
# and using ESlint and Prettier support
cd sveltekit-cogniton-auth
npm install
az vm create --resource-group nym-node-burn --name nym --image UbuntuLTS --admin-username robertohuertasm --admin-password hZRAAJpjkwZ4KW --nics "/subscriptions/e3871cc7-3444-42ad-b4b8-5ee6bdbf6d54/resourceGroups/nym-node-burn/providers/Microsoft.Network/networkInterfaces/nym-nic" --location westeurope --size "Standard_B1s"
<service android:name=".EndlessService"" android:stopWithTask="false" />
override fun onTaskRemoved(rootIntent: Intent) {
val restartServiceIntent = Intent(applicationContext, EndlessService::class.java).also {
it.setPackage(packageName)
};
val restartServicePendingIntent: PendingIntent = PendingIntent.getService(this, 1, restartServiceIntent, PendingIntent.FLAG_ONE_SHOT);
applicationContext.getSystemService(Context.ALARM_SERVICE);
val alarmService: AlarmManager = applicationContext.getSystemService(Context.ALARM_SERVICE) as AlarmManager;
alarmService.set(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + 1000, restartServicePendingIntent);
}
@robertohuertasm
robertohuertasm / .licrc
Last active April 9, 2024 15:59
Simple .licrc config file for Licensebat
# IMPORTANT!: ALL SECTIONS ARE MANDATORY
[licenses]
# This indicates which are the only licenses that Licensebat will accept.
# The rest will be flagged as not allowed.
accepted = ["MIT", "MSC", "BSD"]
# This will indicate which licenses are not accepted.
# The rest will be accepted, except for the unknown licenses or dependencies without licenses.
# unaccepted = ["LGPL"]
# Note that only one of the previous options can be enabled at once.
# If both of them are informed, only accepted will be considered.
@robertohuertasm
robertohuertasm / downcasting.rs
Created August 9, 2020 13:42
Downcasting rust -- error downcasting
use std::any::Any;
/// Method that can be use to safely downcast impl Responder to a specific type T
/// It returns a reference of type T
pub fn downcast<T>(responder: &dyn Any) -> Option<&T>
where
T: Responder + 'static,
{
responder.downcast_ref::<T>()
}