Skip to content

Instantly share code, notes, and snippets.

View heiswayi's full-sized avatar
👽

Heiswayi Nrird heiswayi

👽
View GitHub Profile
#!/bin/bash
##########
# contents
##########
# contents
# notes
# script setup
# git config files
@heiswayi
heiswayi / LargestTriangleThreeBuckets.cs
Created August 22, 2019 11:58 — forked from DanielWJudge/LargestTriangleThreeBuckets.cs
Largest-Triangle-Three Bucket Downsampling Graphs in C#
public static IEnumerable<Tuple<double, double>> LargestTriangleThreeBuckets(List<Tuple<double, double>> data, int threshold)
{
int dataLength = data.Count;
if (threshold >= dataLength || threshold == 0)
return data; // Nothing to do
List<Tuple<double, double>> sampled = new List<Tuple<double, double>>(threshold);
// Bucket size. Leave room for start and end data points
double every = (double)(dataLength - 2) / (threshold - 2);
@heiswayi
heiswayi / TextBoxMaskBehavior.cs
Created November 3, 2018 19:50
WPF utilities: TextBox masking
using System;
using System.Windows;
using System.Windows.Controls;
using System.Globalization;
namespace WpfUtilities
{
public class TextBoxMaskBehavior
{
#region MinimumValue Property
@heiswayi
heiswayi / EncryptDecrypt.cs
Created August 24, 2018 22:14
Encryption & Decryption method for C#
public static string Encrypt(string data, string key)
{
RijndaelManaged rijndaelCipher = new RijndaelManaged();
rijndaelCipher.Mode = CipherMode.CBC;
rijndaelCipher.Padding = PaddingMode.PKCS7;
rijndaelCipher.KeySize = 0x80;
rijndaelCipher.BlockSize = 0x80;
byte[] pwdBytes = Encoding.UTF8.GetBytes(key);
byte[] keyBytes = new byte[0x10];
@heiswayi
heiswayi / copyToGitHub.bat
Last active August 2, 2018 16:33
Batch scripting to copy compiled Jekyll source into GitHub repo, but first delete previous folders and files
@echo off
set from="G:\GIT-REPOS\MyBitBucket\heiswayi.nrird.com\_site"
set to="G:\GIT-REPOS\MyGitHub\heiswayi.github.io"
for %%i in (%to%\*) do (
del /S /Q %%i
)
for /d %%i in (%to%\*) do (
@heiswayi
heiswayi / zipper.php
Created July 20, 2018 17:46
Example of PHP script I used to zip a folder and then force download the zipped file when this script is visited thru web browser
<?php
$dir = 'inescov1';
$zip_file = 'inescov1.zip';
// Get real path for our folder
$rootPath = realpath($dir);
// Initialize archive object
$zip = new ZipArchive();
@heiswayi
heiswayi / EULA.md
Last active October 10, 2023 04:03
Generic desktop app EULA sample

END-USER LICENSE AGREEMENT

This End-User License Agreement (EULA) is a legal agreement between you (either as an individual or on behalf of an entity) and [[AUTHOR]] regarding your use of [[APPNAME]]'s desktop applications, and associated documentation (the "Software"). IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS EULA, DO NOT INSTALL, USE OR COPY THE SOFTWARE.

Summary

  • You must agree to all of the terms of this EULA to use this Software.
  • If so, you may use the Software for free and for any lawful purpose.
  • This Software automatically communicates with its server for three reasons: (1) to receive and install updates; (2) to send error reports; and (3) to send anonymized usage information. You can view sample data to see what information is sent, and you may opt out of sending the anonymized usage data.
  • This Software is provided "as-is" with no warranties, and you agree that [[AUTHOR]] is not liable for anything you do with it.
@heiswayi
heiswayi / canon-g2000-ub005-error.md
Last active January 30, 2020 11:45
Canon G2000 UB005 Error

The waste-ink counter for the BJ F900, F890, F700, F500, S900, S820, S750 and S520 are all reset in the same manner.

Turn off the printer.

Press and hold the RESUME button, then press and hold the POWER button.

Release the RESUME button, then press and release the RESUME button two more times in succession. (youre still holding the POWER button during this). The printer mechanics will move momentarily.

You are now in Service mode.

@heiswayi
heiswayi / webfonts.md
Last active January 30, 2023 23:00
Default font-family for web stuffs

Headings (H1-H6)

font-family: Roboto,-apple-system,BlinkMacSystemFont,"Helvetica Neue","Segoe UI","Oxygen","Ubuntu","Cantarell","Open Sans",sans-serif;

Body

font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
@heiswayi
heiswayi / gist:7775ec456f2e98b739a6c556a19e0cb1
Created April 26, 2018 04:58 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch