Skip to content

Instantly share code, notes, and snippets.

@ProjectInitiative
ProjectInitiative / FlutterLicense.dart
Created January 29, 2019 19:39
A quick example of how to implement a licence page and license dialog in Flutter.
// FlutterLicense utility class
import 'package:flutter/foundation.dart';
class FlutterLicense extends LicenseEntry {
final packages;
final paragraphs;
FlutterLicenses(this.packages, this.paragraphs);
}
@ProjectInitiative
ProjectInitiative / Stopwatch.cs
Created January 29, 2019 19:42
Used to format nanoseconds into HH:MM:SS.ms formatting as well as managing the actual elapsed time in between pauses relative to the system clock time regardless of how many times the user decides to pause and resume. Current functions did not return enough detail to achieve the required accuracy. Provided files are in Java and C#
using System;
/*
Created by Kyle on 3/8/2015.
Note: This class is simply a calculation/String formatting class designed to calculate the elapsed time between two clock readings.
To fully integrate this into a practical use please use a thread to call either getElapsedTime or getElapsedMilliTime and display that text to the screen.
*/
namespace CommonLibrary.Helpers
{
public class Stopwatch
@ProjectInitiative
ProjectInitiative / FutureStreamBuilder.dart
Last active March 25, 2019 19:27
A quick example on how to implement a StreamBuilder that requires a Future<String> within the stream: attribute
FutureBuilder(
future: _getUID(),
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
if (snapshot.connectionState != ConnectionState.done)
return new Center(
child: new Container(child: CircularProgressIndicator()));
return new StreamBuilder(
stream: _getStream(snapshot.data.toString()),
builder: (BuildContext context, userSnapshot) {
// TEMPORARY FIX

Keybase proof

I hereby claim:

  • I am projectinitiative on github.
  • I am kylepetryszak (https://keybase.io/kylepetryszak) on keybase.
  • I have a public key ASCkjdmSHqiIEnGB9101TqFuZEamxp1Ebhq8NB0XlprOuwo

To claim this, I am signing this object:

@ProjectInitiative
ProjectInitiative / pull-all.sh
Last active May 23, 2019 04:31
Pull all immediate Git repo children in the current directory
#!/usr/bin/env bash
for D in `find . -maxdepth 1 -mindepth 1 -type d`
do
echo $D
cd $D
git pull
cd ..
done
@ProjectInitiative
ProjectInitiative / manually-installed.sh
Created January 27, 2020 04:35
Returns all of the manually installed programs on a Linux system.
#!/usr/bin/env bash
comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)
@ProjectInitiative
ProjectInitiative / full-registration.py
Created September 22, 2020 01:12
Two examples of GUI login screens with Python 3 and Tkinter
#!/usr/bin/env python3
'''
The following link is where the majoity of the code is pulled from:
https://www.simplifiedpython.net/python-gui-login/
'''
from tkinter import *
import os
@ProjectInitiative
ProjectInitiative / SafeQueue.hpp
Last active December 11, 2020 04:49
A very useful C++ thread safe queue found here: https://stackoverflow.com/a/16075550
#ifndef SAFE_QUEUE
#define SAFE_QUEUE
#include <queue>
#include <mutex>
#include <condition_variable>
// A threadsafe-queue.
template <class T>
class SafeQueue
@ProjectInitiative
ProjectInitiative / .all-the-useful-tech-things.md
Last active April 29, 2021 15:57
Gist containing useful information and links to fixes and such.

This Gist is a hodgepodge of documentation and information I don't want to lose in the future

@ProjectInitiative
ProjectInitiative / authorized_keys
Last active April 29, 2022 19:25
authorized hosts file
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDJG0c+1iYwH1EzaXzqPop37J8jo9WIh0S1pcOWsyGmwyJXLShdZF2jIkLt/Yi/T2zDVk/5fTXDT0INC0A23pjoX68PuEJ86qsXkneTlhAcmTbpvq5ItqgZVAs01Z8buW9vxmKeFk+nQxRkxKko3OdEqqY+oebFeJcLAwrmBb2ds0xFCrHq2C5IqxDXXpAIr1apBkdFUdgoaTcY0gSPKEls4mIkLozP38CRJsq2cBU38aj8gzkNa+dHJF1w9NE/ZGn45W/g6piZyPePqW5wGbmXF+nNf0suUFfcM4+Iy+65NwIh1NLs+g6lfd60OMxuKwIdEiOQLs9G2mLEy+SdSuo8Wz5Jrb1DIEFifj1FJLM0AHc+rHirR0ln00zJ+nxGVZjIZ/ti5Mv/5nUs6mce4gruN9vz9dVJ18YyoEr/qyQ6dLlFyoQx/B5gMbMBivKpfE3x4nFCslJDBTA2MRegNonkSoW6UVVGsyf6nhZjkQPNrVvQjD2WENAIixhRM5nJ2jsUm8DQRstu+d52cbHcpMlxTXWRv2DrYqoCDVPYlbXTVQlJICX5wm7eG15t05Ua1WgF4hysrUXSG0GNWyi8JriWXh+s9Wdi9rK2Fa7w2EoxEGinvpU52UDrZvU4W5CRL8CctA3M6MNeJPZgXB2xf6Kj12lh3ZDyxr/pUD23Vb8TLw== Laptop
[email protected] AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIAeMkECdnArd2N0oS0XCKer/QZShgfHXP9EnuY8bMHfAAAAABHNzaDo= pop-os-15-04-2022-yubikey1
[email protected] AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIKdfvwr21MLkp463z6p9gaCrwMamZaUhsPPztUrcX19xAAAABHNzaDo= pop-os-20