Skip to content

Instantly share code, notes, and snippets.

View DamianSuess's full-sized avatar
👍
Enjoying every day

Damian DamianSuess

👍
Enjoying every day
View GitHub Profile
@DamianSuess
DamianSuess / Bash-Readme.md
Last active May 20, 2024 16:05
C# Linux BASH

About C# BASH Sample

The example code here references Docker and IoT Edge as an example. The user/pass is Base64 encoded as part of the Bash class in this example.

By no means should you keep the admin user/pass hard-coded in the production class, this is an example piece.

What's The Difference?

The Bash class has both RunAs(..) and Command(..), and each allows you to run using sudo. The difference is, the RunAs(...) method does not require your app to be started with elevated privledges. Where as, Command(..) requires you to start the app with elevated privledges in order to execute commands using sudo.

@DamianSuess
DamianSuess / IJsonService.cs
Created September 14, 2022 20:27
C# Json Service
// <copyright file="IJsonService.cs" company="Xeno Innovations, Inc.">
// Copyright (c) 2022 Xeno Innovations, Inc. All rights reserved.
//
// Reproduction or transmission in whole or in part, in
// any form or by any means, electronic, mechanical, or otherwise, is
// prohibited without the prior written consent of the copyright owner.
// </copyright>
// <author>Damian Suess</author>
using System.Threading.Tasks;
@DamianSuess
DamianSuess / AwaitNonAsyncMethods.cs
Created March 25, 2021 22:00
Await in a Non-Async Method
// Sample 1 - Non-Helper Function Method
public bool HardReset()
{
return HardResetAsync().GetAwaiter().GetResult();
}
public async Task<bool> HardResetAsync()
{
// Real code goes here
await Task.Yield();
@dansiegel
dansiegel / EnumBindingSourceExtension.cs
Created August 18, 2020 18:59
Binding Enums in Xamarin.Forms
using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace AwesomeApp.Xaml
{
[ContentProperty(nameof(Type))]
public class EnumBindingSourceExtension : IMarkupExtension
{
public Type Type { get; set; }
@tianvan
tianvan / DialogHostRegionAdapter.cs
Last active September 12, 2024 06:50
Prism combine with Material Design Toolkit Dialog
namespace Core.Services.Dialog
{
public class DialogHostRegionAdapter : RegionAdapterBase<DialogHost>
{
public DialogHostRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory) : base(regionBehaviorFactory)
{
}
protected override void Adapt(IRegion region, DialogHost regionTarget)
#include "Arduino.h"
#include "esp_camera.h"
#include "ESPAsyncWebServer.h"
typedef struct {
camera_fb_t * fb;
size_t index;
} camera_frame_t;
#define PART_BOUNDARY "123456789000000000000987654321"
@DamianSuess
DamianSuess / Page.xaml
Created August 1, 2018 13:09
Xamarin.Forms - Password hide/show
<Entry x:Name="Email" Placeholder="Email" TextColor="Black" Grid.Row="1" Grid.Column="1"></Entry>
<StackLayout Grid.Row="2" Grid.Column="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Entry IsPassword="True" x:Name="Password" TextColor="Black" Placeholder="Password" Grid.Column="0" Grid.ColumnSpan="2" />
<Image Source="eye32.png" HorizontalOptions="End" VerticalOptions="Center" Grid.Column="1">
<Image.GestureRecognizers>
@DamianSuess
DamianSuess / DroidTelephonySimInfo.cs
Last active January 28, 2022 22:02
Get Android's SIM ICC Id and device's IMEI number
// Requires the following permission in your AndroidManifest.xml
// <uses-permission android:name="android.permission.READ_PHONE_STATE" />
using System.Collections.Generic;
using Android.Telephony;
// ...
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
@brandonsimpson
brandonsimpson / osx_uninstall_mysql_install_mariadb_homebrew.md
Last active June 12, 2024 16:00
OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

This is a short overview on how to completely remove any old mysql server installs in OSX and upgrade to MariaDB without conflicts. Things can get a bit weird when you have various old installs of MySQL server floating around, and utilizing homebrew to install and upgrade MariaDB as a drop in replacement for MySQL has worked well, especially if you're used to managing MySQL installs via yum in linux.

First: Backup Your Data!

Backup all of your current databases with mysqldump

This isn't a tutorial on backups, and there are many ways to do it. You should know how to backup your data anyway. For this example, we'll do a full backup of our InnoDB databases.

@salcode
salcode / .gitignore
Last active February 10, 2024 10:56
See https://salferrarello.com/wordpress-gitignore/ for the latest version of my WordPress .gitignore file
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore