Skip to content

Instantly share code, notes, and snippets.

View kjellski's full-sized avatar
🤓
learning every day...

Kjellski kjellski

🤓
learning every day...
View GitHub Profile
@kjellski
kjellski / PowerShell Customization.md
Created September 2, 2020 12:40 — forked from jchandra74/PowerShell Customization.md
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@kjellski
kjellski / authorize.js
Created May 24, 2018 06:49 — forked from kndt84/authorize.js
Sample code: how to refresh session of Cognito User Pools with Node.js and Express
const AWS = require('aws-sdk');
const CognitoUserPool = require('amazon-cognito-identity-js-node').CognitoUserPool;
const CognitoUserSession = require('amazon-cognito-identity-js-node').CognitoUserSession;
const CognitoUser = require('amazon-cognito-identity-js-node').CognitoUser;
const CognitoIdToken = require('amazon-cognito-identity-js-node').CognitoIdToken;
const CognitoAccessToken = require('amazon-cognito-identity-js-node').CognitoAccessToken;
const CognitoRefreshToken = require('amazon-cognito-identity-js-node').CognitoRefreshToken;
const cfg = require('config').config;
const COGNITO_IDENTITY_POOL_ID = cfg.COGNITO_IDENTITY_POOL_ID;
@kjellski
kjellski / _service.md
Last active August 29, 2015 14:20 — forked from naholyr/_service.md

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
#!/bin/sh
# install build dependencies
sudo apt-get install git mono-mcs mono-gmcs mono-devel autoconf libtool g++ gettext libglib2.0-cil-dev libgtk2.0-cil-dev libglade2.0-cil-dev libgnome2.0-cil-dev libgconf2.0-cil-dev
# add the ssl certs
sudo certmgr -ssl -m https://go.microsoft.com
sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net
sudo certmgr -ssl -m https://nuget.org
mozroots --import --sync
/**
* Console.log with call location and grouping to reduce log noise.
* Apply directly to code once.
*
* Original: http://remysharp.com/2014/05/23/where-is-that-console-log/
*/
var groupable = typeof console.groupCollapsed !== 'undefined';
['log', 'warn'].forEach(function(method) {
var old = console[method];
console[method] = function() {
public class OctopusRestApi : ApiDefinition
{
public OctopusRestApi()
{
#region Projects
Get["/api/projects/all"] = ListAll<ProjectSummaryIndex, Project, ProjectResource>()
.WithDescription("Lists the name and ID of all of the projects in the current Octopus installation. The results will be sorted alphabetically by name.")
.WithCustomQuery(projects => projects.OrderBy(m => m.Name));
Get["/api/projects/{id}"] = Load<Project, ProjectResource>()
/// <summary>
/// Executes a particular piece of code based on the type of the argument.
/// </summary>
public static class TypeSwitch
{
/// <summary>
/// Executes a particular piece of code based on the type of the argument.
/// </summary>
/// <typeparam name="TSource">The argument's type.</typeparam>
/// <param name="value">The switch argument.</param>
// Place user-specific overrides in this file, to ensure they're preserved
// when upgrading
{
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules"]
}
--tree-filter 'rm -rf *.suo *.user *.sln.docstates [Dd]ebug [Dd]ebugPublic [Rr]elease x64 build bld [Bb]in [Oo]bj [Tt]est[Rr]esult* [Bb]uild[Ll]og.* *.VisualState.xml TestResult.xml *_i.c *_p.c *_i.h *.ilk *.meta *.obj *.pch *.pdb *.pgc *.pgd *.rsp *.sbr *.tlb *.tli *.tlh *.tmp *.tmp_proj *.log *.vspscc *.vssscc .builds *.pidb *.svclog *.scc _Chutzpah* ipch *.aps *.ncb *.opensdf *.sdf *.cachefile *.psess *.vsp *.vspx \$tf *.gpState _ReSharper* *.[Rr]e[Ss]harper *.DotSettings.user .JustCode _TeamCity* *.dotCover *.ncrunch* _NCrunch_* .*crunch*.local.xml *.mm.* AutoTest.Net [Ee]xpress DocProject/buildhelp DocProject/Help/*.HxT DocProject/Help/*.HxC DocProject/Help/*.hhc DocProject/Help/*.hhk DocProject/Help/*.hhp DocProject/Help/Html2 DocProject/Help/html publish *.Publish.xml *.azurePubxml csx *.build.csdef AppPackages sql *.Cache ClientBin [Ss]tyle[Cc]op.* ~\$* *~ *.dbmdl *.dbproj.schemaview *.[Pp]ublish.xml *.pfx *.publishsettings Generated_Code _UpgradeReport_Files Backup* UpgradeLog*.XML UpgradeLog*.htm Ap
<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>