Skip to content

Instantly share code, notes, and snippets.

View heiswayi's full-sized avatar
👽

Heiswayi Nrird heiswayi

👽
View GitHub Profile
@heiswayi
heiswayi / SimplestLoggerUtility.cs
Created March 10, 2018 04:56
Simplest logger utility class using Windows built-in logging facility
using System;
using System.Diagnostics;
namespace SimplestLoggerUtility
{
public static class Logger
{
public static void Success(string message)
{
EventLog.WriteEntry(AppDomain.CurrentDomain.FriendlyName, message, EventLogEntryType.Information);
@heiswayi
heiswayi / TFSBuildVarsDebug.ps1
Created February 18, 2018 17:09
List all TFS built-in variables for Team Foundation Build (vNext) using PowerShell script
Write-Host "SYSTEM_TEAMPROJECT: $ENV:SYSTEM_TEAMPROJECT"
Write-Host "SYSTEM_TEAMFOUNDATIONSERVERURI: $ENV:SYSTEM_TEAMFOUNDATIONSERVERURI"
Write-Host "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI: $ENV:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"
Write-Host "SYSTEM_COLLECTIONID: $ENV:SYSTEM_COLLECTIONID"
Write-Host "SYSTEM_DEFAULTWORKINGDIRECTORY: $ENV:SYSTEM_DEFAULTWORKINGDIRECTORY"
Write-Host "BUILD_DEFINITIONNAME: $ENV:BUILD_DEFINITIONNAME"
Write-Host "BUILD_DEFINITIONVERSION: $ENV:BUILD_DEFINITIONVERSION"
Write-Host "BUILD_BUILDNUMBER: $ENV:BUILD_BUILDNUMBER"
Write-Host "BUILD_BUILDURI: $ENV:BUILD_BUILDURI"
Write-Host "BUILD_BUILDID: $ENV:BUILD_BUILDID"

Simplicity is prerequisite for reliability. --Edger Djikstra

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@heiswayi
heiswayi / SimpleAuth.php
Created December 20, 2017 14:28
Simple PHP script to protect any PHP page using session
<?php
/*
* Filename: SimpleAuth.php
* Version: 1.0
* Author: Heiswayi Nrird
* Dscription: Simple PHP script to protect any PHP page using session
* Website: https://heiswayi.nrird.com
*
* HOW TO USE
* ==========
@heiswayi
heiswayi / form-ui.html
Created November 6, 2017 19:06
Form UI Mockup Framework
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Formalize CSS</title>
</head>
<body>
<div id="wrapper">
<h1>
Example of all form elements
@heiswayi
heiswayi / img-upload.php
Created October 25, 2017 16:44
Internal Image Hosting Script
<?php
// Configuration
$title = 'Internal Image Hosting Script';
$filedir = 'up'; // uploaded image dir
$maxsize = 5242880; //max size in bytes
$allowedExts = array('png', 'jpg', 'jpeg', 'gif');
$allowedMime = array('image/png', 'image/jpeg', 'image/pjpeg', 'image/gif');
$baseurl = $_SERVER['HTTP_HOST'].dirname($_SERVER['REQUEST_URI']).'/'.$filedir;
function compressImage($source_url, $destination_url, $quality) {
@heiswayi
heiswayi / fm.php
Created October 25, 2017 14:00
Single PHP File Manager Script - Screenshot: https://i.imgur.com/4OtrKUz.png
<?php
/**
* File Manager Script
*/
// Default language ('en' and other from 'filemanager-l10n.php')
$lang = 'en';
// Auth with login/password (set true/false to enable/disable it)
$use_auth = true;
using System;
// it's required for reading/writing into the registry:
using Microsoft.Win32;
// and for the MessageBox function:
using System.Windows.Forms;
namespace Utility.ModifyRegistry
{
public class ModifyRegistry
{
@heiswayi
heiswayi / progress.ps1
Last active February 8, 2017 16:23
Update progress in PowerShell
$Num = 5
$Jobs = @()
ForEach ($Job in (1..$Num))
{ $Jobs += Start-Job -ScriptBlock {
$Count = 1
Do {
Write-Progress -Id 2 -Activity "Background Job" -Status $Count -PercentComplete 1
$Count ++
Start-Sleep -Seconds 4