Skip to content

Instantly share code, notes, and snippets.

View weeksdev's full-sized avatar
🏠
Working from home

Andrew Weeks weeksdev

🏠
Working from home
View GitHub Profile
@weeksdev
weeksdev / portproxy.md
Created April 1, 2019 17:15
NETSH PORT PROXY

Creating a proxy netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=[LOCAL_PORT] connectaddress=[REMOTE_SERVER_NAME] connectport=[REMOTE_SERVER_PORT]

Delete the proxy netsh interface portproxy delete v4tov4 listenport=[LOCAL_PORT] listenaddress=0.0.0.0

Show All Proxies netsh interface portproxy show all

@weeksdev
weeksdev / promise.ts
Last active March 28, 2019 14:01
Angular Promise and then using async/await
// some.service.ts
public async getData(): Promise<SomeType> {
try {
return await this.http.get<SomeType>("api/some/url")
.toPromise()
} catch (error) {
this.handleError(error);
return null;
@weeksdev
weeksdev / git-commands.md
Last active December 19, 2018 15:41
Git Commands Cheatsheet

Basic Commands

Add all files for staging:

git add -A

Commit all changes that are staged:

git commit -m "some message"

@weeksdev
weeksdev / kill-process-on-port.txt
Created July 11, 2018 18:32
Kill a process on a port
lsof -i :{PORT_NUMBER}
kill -TERM {PID}
@weeksdev
weeksdev / Unity
Created August 7, 2017 14:54
Unity settings
unity.RegisterTypes(Assembly.GetExecutingAssembly().ExportedTypes, WithMappings.FromMatchingInterface, WithName.Default);
@weeksdev
weeksdev / currency.js
Created July 6, 2017 13:49
angular currency format example
app.directive('currency', function () {
return {
require: 'ngModel',
link: function(elem, $scope, attrs, ngModel){
ngModel.$formatters.push(function(val){
return '$' + val
});
ngModel.$parsers.push(function(val){
return val.replace(/^\$/, '')
});
@weeksdev
weeksdev / command-to-run.cmd
Created June 1, 2017 15:14
self signed cert in chain
npm config set strict-ssl false
@weeksdev
weeksdev / TestController.cs
Created May 2, 2017 15:31
Angular / C# Web Api File Upload
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web;
namespace App.controller
{
@weeksdev
weeksdev / global.asax.cs
Created September 26, 2016 19:12
Global Web Api Config
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Security;
using System.Web.SessionState;
namespace TestyMesty
{
@weeksdev
weeksdev / non-disabled-users.ldap
Created July 7, 2016 16:08
non-disabled-users.ldap
(&(anr=someName)(&(objectCategory=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))))