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 / osx_uninstall_mysql_install_mariadb_homebrew.md
Created March 18, 2016 14:56 — forked from brandonsimpson/osx_uninstall_mysql_install_mariadb_homebrew.md
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.

@DamianSuess
DamianSuess / MainActivity.cs
Created September 9, 2016 17:14
Android - Enforce Screen Orientation
namespace TestApp.Droid
{
[Activity(Label = "TestApp",
Icon = "@drawable/icon",
Theme = "@style/MyTheme",
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
NoHistory = true)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
@DamianSuess
DamianSuess / MainActivity.cs
Last active September 9, 2016 17:17
Android - Remove Title and Notification bars
namespace TestApp.Droid
{
[Activity(Label = "myApp",
MainLauncher = true,
Icon = "@drawable/Icon",
ScreenOrientation = ScreenOrientation.Landscape)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
@DamianSuess
DamianSuess / DroidBluetoothConnectAsync.cs
Last active September 12, 2016 00:43
Android connect to Bluetooth device asynchronously
/*
Source:
https://forums.xamarin.com/discussion/30055/connecting-to-a-bluetooth-scanner-with-xamarin-android#Comment_94845
The problem relates to device.GetUuids. You are assuming the Uuid is what you
want with ElementAt(0). What you need is a loop inside your foreach, like in
the following testing, that the device supports the Bluetooth Serial Port Profile
*/
ParcelUuid[] uuids = device.GetUuids();
@DamianSuess
DamianSuess / ThreadBgWorker.cs
Created October 22, 2016 20:26
Thread Background Worker
namespace XI.Template
{
using System.ComponentModel;
class ThreadTest
{
#region Constructor and attributes
private System.ComponentModel.BackgroundWorker _thread;
@DamianSuess
DamianSuess / CombinedGuid.cs
Created October 24, 2016 19:24
Db-CombinedGuid
//
// Used to create a Combined GUID for database Primary Keys
//
public Guid GenerateComb()
{
// T-SQL Equivalent
// DECLARE @guid UNIQUEIDENTIFIER;
// SET @guid = CAST(CAST(NEWID() AS BINARY(10)) + CAST(GETDATE() AS BINARY(6)) AS UNIQUEIDENTIFIER);
// SELECT @guid;
@DamianSuess
DamianSuess / Benchmark.cs
Created June 2, 2017 16:28
C# Benchmark
using System.Diagnostics;
// ...
Stopwatch sw = new Stopwatch();
sw.Start();
// ...
sw.Stop();
Console.WriteLine("Elapsed={0}", sw.Elapsed);
@DamianSuess
DamianSuess / MartialString.cpp
Created June 13, 2017 21:47
Managed C++, convert String^ to std::string
/// ----------------------------------------------------------------------------
/// <summary>Convert from String^ to std::string</summary>
System::Void TestClass::MarshalString(String ^ strIn, string& strOut)
{
using namespace Runtime::InteropServices;
const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(strIn)).ToPointer();
strOut = chars;
Marshal::FreeHGlobal(IntPtr((void*)chars));
}
@DamianSuess
DamianSuess / DoubleLinkedList.cs
Last active June 28, 2017 19:00 — forked from yetanotherchris/gist:4960171
Double Linked List C# example
public static void Main()
{
DoubleLinkedList list = new DoubleLinkedList();
list.Insert("1");
list.Insert("2");
list.Insert("3");
DoubleLink link4 = list.Insert("4");
list.Insert("5");
Console.WriteLine("List: " + list);
@DamianSuess
DamianSuess / GuiThreadSafeUpdates.cs
Created October 10, 2017 16:35
GUI Thread-Safe Updates
namespace XenoInc.Gist
{
public static class Test
{
/// <summary>
/// Execute on UI thread asynchronously (don't wait for completion)
/// </summary>
/// <param name="control"></param>
/// <param name="code"></param>
/// <example>