Skip to content

Instantly share code, notes, and snippets.

@creatigent
creatigent / QueryDotnet.js
Created March 3, 2021 15:53 — forked from kphillisjr/QueryDotnet.js
JSCript.NET Working Examples
/*
To Compile:
PATH\\TO\\jsc.exe QueryDotnet.js
This example is based on:
https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
*/
import System;
import Microsoft.Win32;
@creatigent
creatigent / SimpleLogger.cs
Created February 27, 2021 02:29 — forked from heiswayi/SimpleLogger.cs
Simple C# logger utility class | Blog: https://heiswayi.nrird.com/simple-logger-utility
/*
MIT License
Copyright (c) 2016 Heiswayi Nrird
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@creatigent
creatigent / jwt_golang_example.go
Created October 21, 2020 02:47 — forked from thealexcons/jwt_golang_example.go
JSON Web Tokens in Go
package main
import (
"io/ioutil"
"log"
"strings"
"net/http"
"encoding/json"
"fmt"
"time"
@creatigent
creatigent / post-json.go
Last active October 20, 2020 17:38 — forked from ReeganExE/post-json.go
Sample POST json in Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"os"
package main
import (
"github.com/gin-gonic/gin"
"os"
"log"
"net/http"
"encoding/json"
)
@creatigent
creatigent / address.go
Created October 11, 2020 22:35 — forked from delsner/address.go
Go HTTP REST API with http servemux
package controllers
import (
"net/http"
"strings"
)
type AddressController struct {
*Controller
}
@creatigent
creatigent / git_from_python_script.py
Created October 10, 2020 14:35 — forked from nathania/git_from_python_script.py
Execute git command from Python script
from subprocess import Popen, PIPE
from os import path
git_command = ['/usr/bin/git', 'status']
repository = path.dirname('/path/to/dir/')
git_query = Popen(git_command, cwd=repository, stdout=PIPE, stderr=PIPE)
(git_status, error) = git_query.communicate()
if git_query.poll() == 0:
# Do stuff
@creatigent
creatigent / update-golang.md
Created September 15, 2020 19:38 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

@creatigent
creatigent / knockoutUtility.js
Created October 1, 2018 19:17 — forked from mbejda/knockoutUtility.js
List of Knockout Utility Functions
ko.utils.arrayForEach
ko.utils.arrayFirst
ko.utils.arrayFilter
ko.utils.arrayGetDistinctValues
ko.utils.arrayIndexOf
ko.utils.arrayMap
ko.utils.arrayPushAll
ko.utils.arrayRemoveItem
ko.utils.extend
ko.utils.fieldsIncludedWithJsonPost
@creatigent
creatigent / Deploy-Windows-Service-Via-MSBuild.proj.xml
Created December 5, 2017 14:18 — forked from mrchief/Deploy-Windows-Service-Via-MSBuild.proj.xml
MSBuild Script to deploy Windows Service to remote or local machine
<Project DefaultTargets="CopyOutputs;DeployService" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<!-- These settings control what the service's name, description etc appear in services.msc task panel. -->
<PropertyGroup Label="ServiceMetaData">
<ServiceName>ShinyNewService</ServiceName>
<ServiceDisplayName>Shiny New Service</ServiceDisplayName>
<ServiceDescription>A shiny new service, that changes the world for the greater good.</ServiceDescription>
</PropertyGroup>
<Choose>