Skip to content

Instantly share code, notes, and snippets.

View nishants's full-sized avatar
👨‍💻
I may be slow to respond.

Nishant Singh nishants

👨‍💻
I may be slow to respond.
View GitHub Profile
@nishants
nishants / SSL.tests.ps1
Created March 5, 2021 03:27 — forked from PlagueHO/SSL.tests.ps1
PowerShell Pester Tests for checking SSL endpoints
<#
.DESCRIPTION
Outputs the SSL protocols that the client is able to successfully use to connect to a server.
.PARAMETER ComputerName
The name of the remote computer to connect to.
.PARAMETER Port
The remote port to connect to. The default is 443.
@nishants
nishants / cleanup_node_modules.js
Last active January 10, 2023 20:50
node script to cleanup node modules on local dir
const path = require("path");
const fs = require("fs");
const getChildOf = (s) => new Promise(resolve => {
return fs.readdir(s, (e, children) => resolve(children.map(c => `${s}${path.sep}${c}`)));
});
const isDirectory = path => fs.lstatSync(path).isDirectory();
const cleanup = async (path) => {
const children = await getChildOf(path);
@nishants
nishants / Markdium-typescript.ts
Created February 8, 2020 12:40
Markdium-Creating VSCode Extension
import * as vscode from 'vscode';
// Runs when extension is activated (very first time the command is executed)
export function activate(context: vscode.ExtensionContext) {
console.log('Congratulations, your extension "helloworld" is now active!');
// Create handler for command defined in package.json file
const disposable = vscode.commands.registerCommand('extension.helloWorld', () => {
// Runs every single time comand is executed
@nishants
nishants / Markdium-YAML.yml
Created February 8, 2020 12:40
Markdium-Creating VSCode Extension
main: "./out/extension.js",
activationEvents: [
"onCommand:extension.helloWorld"
],
contributes: {
commands: [{
"command": "extension.helloWorld",
"title": "Hello World"
}]
}
@nishants
nishants / Markdium-typescript.ts
Created February 8, 2020 12:40
Markdium-Creating VSCode Extension
// Display a message box to the user
vscode.window.showInformationMessage(
'Hello World!',
"Options 1 - Say back hello",
"Options 2 - Ignore the hello",
"Options 3 - Checkout this option",
).then(chosen => {
vscode.window.showInformationMessage(`You chose : ${chosen || 'nothing'}`);
});
@nishants
nishants / Markdium-typescript.ts
Created February 8, 2020 12:40
Markdium-Creating VSCode Extension
/**
* Show an information message to users. Optionally provide an array of items which will be presented as clickable buttons.
* @param message The message to show.
* @param items A set of items that will be rendered as actions in the message.
* @return A thenable that resolves to the selected item or `undefined` when being dismissed.
*/
export function showInformationMessage(message: string, ...items: string[]): Thenable;
@nishants
nishants / Markdium-Shell.bash
Created February 8, 2020 12:40
Markdium-Creating VSCode Extension
# install yeoman and visual studieo code generator
npm install -g yo generator-code
# create a new project boilerplate
yo code
# select a typescript project
# select the name as helloworld
@nishants
nishants / Markdium-YAML.yml
Created February 8, 2020 12:40
Markdium-Creating VSCode Extension
new file: .eslintrc.json
new file: .gitignore
new file: .vscode/extensions.json
new file: .vscode/launch.json
new file: .vscode/settings.json
new file: .vscode/tasks.json
new file: .vscodeignore
new file: CHANGELOG.md
new file: README.md
new file: package-lock.json
@nishants
nishants / Markdium-powershell.ps1
Last active February 8, 2020 12:24
Markdium-A Quick Byte of Powershell Core for Javascript Developers
# Operators
#############################
# Powershell # Javascript
$name = 'Rohit' # var name = 'Rohit'
1 -eq 1 # 1 == 1
1 -neq 1 # 1 != 1
1 -gt 2 # 1 >= 2
1 -lt 2 # 1 < 2
1 -le 1 # 1 <= 1
2 -ge 1 # 2 >= 1
@nishants
nishants / Markdium-powershell.ps1
Created February 8, 2020 12:20
Markdium-A Quick Byte of Powershell Core for Javascript Developers
<#
JavaScript uses /* comments */ for multiline comments
Powershell uses <# comments #> for multiline comments
#>
# Javascript uses // for single line comment
# Powershell uses # for single line comment
# JavaScript - writting console log