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
@pcgeek86
pcgeek86 / cheatsheet.ps1
Last active April 16, 2024 14:56
PowerShell Cheat Sheet / Quick Reference
Get-Command # Retrieves a list of all the commands available to PowerShell
# (native binaries in $env:PATH + cmdlets / functions from PowerShell modules)
Get-Command -Module Microsoft* # Retrieves a list of all the PowerShell commands exported from modules named Microsoft*
Get-Command -Name *item # Retrieves a list of all commands (native binaries + PowerShell commands) ending in "item"
Get-Help # Get all help topics
Get-Help -Name about_Variables # Get help for a specific about_* topic (aka. man page)
Get-Help -Name Get-Command # Get help for a specific PowerShell function
Get-Help -Name Get-Command -Parameter Module # Get help for a specific parameter on a specific command
@grenzi
grenzi / Set-PsEnv.psm1
Last active February 21, 2023 23:11
sets powershell environment variables from python-dotenv formatted .env file
<#
.Synopsis
Exports environment variable from the .env file to the current process.
.Description
This function looks for .env file in the current directoty, if present
it loads the environment variable mentioned in the file to the current process.
based on https://github.com/rajivharris/Set-PsEnv
// groupcities.js
// An alternative solution to:
// https://dev.to/albinotonnina/how-to-lose-a-it-job-in-10-minutes-35pi
//
// Given an array of city names, group the ones that are rotations of
// each other together. e.g.:
//
// input: ['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris']
// output:
// [
@mvlabat
mvlabat / parcel-node-target-hotreload.js
Created May 9, 2018 13:36
Parcel bundler for hotreloading node.js target. Start with `run` argument in order get your index.js running after each rebuild
const Bundler = require('parcel-bundler');
const childProcess = require('child_process');
const file = 'index.js';
const options = {};
const bundler = new Bundler(file, options);
const runBundle = process.argv.includes('run');
let bundle = null;
@Celoxocis
Celoxocis / powershell_commands.md
Created February 14, 2018 13:26
Collection of handy PowerShell commands

PowerShell Commands

Sanity check (i.e., change term window size)

mode con:cols=150 lines=50

Set execution policy

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

Unset execution policy

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Undefined

@jchandra74
jchandra74 / PowerShell Customization.md
Last active March 1, 2024 01:02
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.

@itod
itod / split_keyboards.md
Last active April 25, 2024 16:26
Every "split" mechanical keyboard currently being sold that I know of
@kndt84
kndt84 / authorize.js
Last active April 10, 2024 15:15
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;
@robertpenner
robertpenner / employee_salaries.ts
Last active June 26, 2020 23:16
Employee Average Salaries | Victor Savkin's Functional TypeScript
// https://vsavkin.com/functional-typescript-316f0e003dc6
class Employee {
constructor(public name: string, public salary: number) {}
}
class Department {
constructor(public employees: Employee[]) {}
works(employee: Employee): boolean {
//returns a promise that resolves after a time
function wait(time){
return new Promise(function(resolve){
window.setTimeout(resolve,time);
});
}
//a function that, if called with just a time,
//returns a function that will return a wait...
//that resolves with whatever value it was given