Skip to content

Instantly share code, notes, and snippets.

View midnite81's full-sized avatar

Simon Rogers midnite81

View GitHub Profile
@midnite81
midnite81 / AlphabeticalOrderJsonContractResolver.cs
Created February 5, 2021 11:56 — forked from mbrookson/AlphabeticalOrderJsonContractResolver.cs
.NET Core alphabetical property name JSON serializer
public class AlphabeticalOrderJsonContractResolver : CamelCasePropertyNamesContractResolver
{
protected override IList<JsonProperty> CreateProperties(
Type type,
MemberSerialization memberSerialization
)
{
return base.CreateProperties(type, memberSerialization)
.OrderBy(p => p.PropertyName)
.ToList();
@midnite81
midnite81 / Instructions.md
Created February 2, 2021 11:16 — forked from pgilad/Instructions.md
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example

@midnite81
midnite81 / README.md
Created July 30, 2020 08:57 — forked from andreasonny83/README.md
Run node app in background

Run node app in background

Running a script in the background in linux can be done using nohup, using nohup we can run node application in the background

$ nohup node server.js > /dev/null 2>&1 &
  • nohup means: Do not terminate this process even when the stty is cut off
  • &gt; /dev/null means: stdout goes to /dev/null (which is a dummy device that does not record any output)
@midnite81
midnite81 / httpdocs-switch
Created May 14, 2020 06:36
Switches the httpdocs and httpdocs-release folders around
#!/bin/bash
if [ -d httpdocs-release ]; then
mv httpdocs httpdocs-holding
mv httpdocs-release httpdocs
mv httpdocs-holding httpdocs-release
else
echo "No httpdocs-release folder!"
fi
@midnite81
midnite81 / GPG-Commands.md
Last active June 20, 2020 23:59
GPG Commands

List Keys

gpg --list-secret-keys --keyid-format LONG

Set Global Singing Key

git config --global user.signingkey 
@midnite81
midnite81 / README.md
Created March 4, 2020 11:30 — forked from BoGnY/README.md
[WINDOWS] How to enable auto-signing Git commits with GnuPG for programs that don't support it natively

[WINDOWS] How to enable auto-signing Git commits with GnuPG for programs that don't support it natively

This is a step-by-step guide on how to enable auto-signing Git commits with GPG for every applications that don't support it natively (eg. GitHub Desktop, Eclipse, Git Tower, ...)

Requirements

  • Install GPG4Win: this software is a bundle with latest version of GnuPG v2, Kleopatra v3 certificate manager, GNU Privacy Assistant (GPA) v0.9 which is a GUI that uses GTK+, GpgOL and GpgEX that are respectively an extension for MS Outlook and an extension for Windows Explorer shell
  • Install Git for Windows: so you can have a *nix based shell, this software is a bundle with latest version of Git which use MINGW environment, a Git bash shell, a Git GUI and an extension for Windows Explorer shell (Make sure your local version of Git is at least 2.0, otherwise Git don't have support for automatically sign your commits)
  • Verify
@midnite81
midnite81 / README.md
Created February 1, 2020 09:11 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
@midnite81
midnite81 / Retrieve Variables from Jenkins
Last active June 21, 2020 10:32
A script to retrieve variables from Jenkins
import com.cloudbees.plugins.credentials.*;
import com.cloudbees.plugins.credentials.domains.Domain;
import org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl;
println "Jenkins credentials config file location=" + SystemCredentialsProvider.getConfigFile();
println ""
def fileName = "<nameOfFile>" // e.g appsettings.Development.json
SystemCredentialsProvider.getInstance().getCredentials().stream().
@midnite81
midnite81 / push.sh
Last active June 21, 2020 00:03
Command to push to nuget
dotnet nuget push {package} -k {key} -s https://api.nuget.org/v3/index.json
@midnite81
midnite81 / JetBrains-KeyboardShortcuts.md
Last active January 12, 2020 15:12
My JetBrains Keyboard Shortcuts

General Files

Shortcut Command
⌘+, Settings
⌘+P Navigate > File
⌘+R Navigate > File Structure
⌘+D Edit > Find > Add selection for Next Occurrence
⌘+⇧+D Edit > Duplicate Line or Selection
⌥+T Refactor > Pull Members Up