Skip to content

Instantly share code, notes, and snippets.

View necrophidia's full-sized avatar
🖋️
Be humble, be hungry, and always be the hardest worker in the room ~the rock

Phillip Leonardo necrophidia

🖋️
Be humble, be hungry, and always be the hardest worker in the room ~the rock
View GitHub Profile
@necrophidia
necrophidia / simple_date_format_retriever.go
Last active January 18, 2021 06:51
Simple date layout retrieved from raw date string in golang, the layout used is with day first
func GetDateFormatForParsing(rawDate string) string {
separator := "/"
dayCharacterCount := 0
slashParts := strings.Split(rawDate, "/")
dashParts := strings.Split(rawDate, "-")
if len(dashParts) > 1 {
dayCharacterCount = len(dashParts[0])
separator = "-"
@necrophidia
necrophidia / .zshrc
Last active March 5, 2022 00:14
Add colored Git Branch information to your ZSH PROMPT
# Load colors, auto-completion, and version control information
autoload -Uz compinit colors vcs_info
colors
compinit
precmd() { vcs_info }
# Format the vcs_info_msg_0_ variable, see https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg for color number (replace 039 with any number you wanted)
zstyle ':vcs_info:git:*' formats '[%F{039}%b%f]'
# Set up the prompt (with git branch name)
@necrophidia
necrophidia / sqitch.yml
Last active January 14, 2021 00:37
Github workflow definition for validation with postgres and sqitch (https://sqitch.org/). Put this inside .github/workflows/ folder at your repository
name: Sqitch Validation
on:
# Enable pipeline on code push
push:
# Enable pipeline on pull request
pull_request:
# Enable pipeline manual triggers
workflow_dispatch:
@necrophidia
necrophidia / ExchangeReader.cs
Last active February 5, 2018 10:23
Exchange Web Content Reader Sample
using System;
using System.Net;
using Microsoft.Exchange.WebServices.Data;
namespace ExchangeReader
{
class Program
{
static ExchangeService ConnectToService(string url, string username, string password, string domain)
{
@necrophidia
necrophidia / GetOSFriendlyName.cs
Created February 5, 2018 08:36
Code Snipplet for Getting Microsoft Windows OS Friendly Name (i.e. Microsoft Windows 10 Home)
using System;
using System.Management;
namespace OSFriendlyName
{
class Program
{
static void Main(string[] args)
{
string result = string.Empty;
@necrophidia
necrophidia / SimplePerformanceCounter.cs
Created February 5, 2018 05:15
Simple Sample To Use Performance Counter
using System;
namespace PerformanceCounter
{
class Program
{
static void Main(string[] args)
{
using (var counter = new System.Diagnostics.PerformanceCounter("Memory", "Available MBytes"))
{
@necrophidia
necrophidia / UserUnitTableSeeder.php
Created October 6, 2017 07:09
Laravel Seeder Sample With Truncate Table Function
<?php
use Illuminate\Database\Seeder;
class UserUnitTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
@necrophidia
necrophidia / DateHelper.php
Last active October 6, 2017 07:01
Laravel Custom Date Helper
<?php // Date Helper
namespace App\Helpers;
use Carbon\Carbon;
class DateHelper
{
public static function parse_from_datepicker($date_raw)
{
@necrophidia
necrophidia / wsus_without_dc.reg
Last active March 6, 2023 15:33
wsus registry without domain controller. Replace "WUServer" and "WUStatusServer" with corresponding server ip address.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate]
"AcceptTrustedPublisherCerts"=dword:00000001
"ElevateNonAdmins"=dword:00000001
"TargetGroup"="Workstations"
"TargetGroupEnabled"=dword:00000000
"WUServer"="http://10.72.3.192:8530";
"WUStatusServer"="http://10.72.3.192:8530";