Skip to content

Instantly share code, notes, and snippets.

@iqbmo04
iqbmo04 / linkify.php
Created December 16, 2018 23:44 — forked from jasny/linkify.php
PHP function to turn all URLs in clickable links
<?php
/**
* Turn all URLs in clickable links.
*
* @param string $value
* @param array $protocols http/https, ftp, mail, twitter
* @param array $attributes
* @param string $mode normal or all
* @return string
*/
@iqbmo04
iqbmo04 / serve.sh
Created December 20, 2018 12:42 — forked from sincarne/serve.sh
Shell function to start a server
# Add this to your .profile
# Typing `serve` with no arguments will start the PHP inbuilt
# server, listening on port 8000.
# If you provide an argument, that is assumed to be the port
# on which to listen.
function serve() {
if [ $# -eq 0 ]; then
php -S localhost:8000
else
php -S localhost:"$@"
@iqbmo04
iqbmo04 / #selenium-chrome-authentication-extension
Created January 26, 2019 10:09 — forked from florentbr/#selenium-chrome-authentication-extension
Chrome extension to automatically set the credentials.
To build the extension, update the username/password and zip `background.js` and `manifest.json` in a single archive.
@iqbmo04
iqbmo04 / DemoToShowHowToRunSuitesInParallelViaTestNGAPI.java
Created February 11, 2019 10:37 — forked from krmahadevan/DemoToShowHowToRunSuitesInParallelViaTestNGAPI.java
A sample that shows how to Use the TestNG APIs and run suites in parallel
package testng.samples;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import org.testng.ITestContext;
import org.testng.TestNG;
@iqbmo04
iqbmo04 / Split-File.ps1
Created April 17, 2019 18:44 — forked from awayken/Split-File.ps1
Split files using Powershell, modified from: http://stackoverflow.com/a/11010158/215200
# Modified from: http://stackoverflow.com/a/11010158/215200
$fromFolder = "D:\FOLDER\"
$rootName = "FILENAME"
$ext = "EXT"
$from = "{0}{1}.{2}" -f ($fromFolder, $rootName, $ext)
$fromFile = [io.file]::OpenRead($from)
$upperBound = 100MB
@iqbmo04
iqbmo04 / A.Readme.md
Created April 18, 2019 16:59 — forked from cr7pt0gr4ph7/A.Readme.md
A small demo program in C#, demonstrating the dynamic generation of Xunit tests for each filename in a search path, where the filename matches a pattern. See the included Readme.md file.

A small demo program in C#, demonstrating the dynamic generation of Xunit tests for each filename in a search path, where the filename matches a pattern. This Gist requires xUnit.net to compile.

After reading in the EnumerateFilesFixtureAttribute on the type Tests.AutoPopulatedTest, the main program enumerates all files in the path specified by the attribute that also match the searchPattern (e.g. "*.json").

It then uses System.Reflection.Emit to emit a test method for each of the files found. Each generated test method is also decorated with a [Xunit.FactAttribute] to make the Xunit test runner recognize it.

By modifying the value of the generated DisplayName property, one can change how the generated tests are displayed in the Xunit GUI runner, for example.

<#
.SYNOPSIS
Gets a PowerShell Credential (PSCredential) from the Windows Credential Manager
.DESCRIPTION
This module will return a [PSCredential] object from a credential stored in Windows Credential Manager. The
Get-StoredCredential function can only access Generic Credentials.
Alias: GSC
$TotalNumberVersionsToKeep=100
$BackupFolder = "\\osgdesign\Studio\Windows\Users\v-senefe\Backup" # make sure there is no ending \
$ProjectFolder = "C:\DesignDepot.Git" # make sure there is no ending \
$ProjectFolderName = [System.IO.Path]::GetFileName($ProjectFolder)
Push-Location -Path $ProjectFolder
$changes = CMD.EXE /C git ls-files --modified --others --exclude-standard | Out-String
if ($changes.Length -eq 0){
Exit
}
@iqbmo04
iqbmo04 / TheFullMonty.ps1
Created May 14, 2019 06:39 — forked from h1bay1/TheFullMonty.ps1
The Final Product
Import-Module PSSlack
$checkoutPath = 'C:\Temp'
$repoUri = 'https://github.com/githubtraining/hellogitworld.git'
$repoFolder = 'hellogitworld'
$branchMatch = '*'
$defaultBranch = 'master'
$pushChanges = $false
$success = ":check2:"
$failed = ":x-cross:"
$mergeText = "*Merge Successful*"
@iqbmo04
iqbmo04 / Send-NetworkData.ps1
Created May 17, 2019 17:59 — forked from jstangroome/Send-NetworkData.ps1
A simple PowerShell implementation of the most basic functionality of Netcat
function Send-NetworkData {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string]
$Computer,
[Parameter(Mandatory)]
[ValidateRange(1, 65535)]
[Int16]