Skip to content

Instantly share code, notes, and snippets.

View PramodKumarYadav's full-sized avatar

Pramod Kumar Yadav PramodKumarYadav

View GitHub Profile
@wilwang
wilwang / gist:3034508
Created July 2, 2012 17:40
Nano :: create db if not exists
var nano = require('nano')('http://localhost:5984');
var dbName = 'testdb';
var testDb = nano.use(dbName);
nano.db.list(function(error, databases) {
if (error)
return console.log('ERROR :: nano.db.list - %s', JSON.stringify(error));
if (databases.indexOf(dbName) < 0) {
nano.db.create(dbName, function(error, body, headers) {
@ff6347
ff6347 / clone_remote_branch.md
Last active April 13, 2023 19:34
clone remote branch with git
@d3noob
d3noob / .block
Last active April 8, 2024 12:19
Sankey diagram from formatted JSON
license: mit
$targDir = "C:\dev\LMS-client-ADA";
Get-ChildItem $targDir -Filter *.pdf |
Foreach-Object {
$oldname = $_.FullName;
$newname = $_.FullName.Replace(" ", "_");
$newname = $newname -replace "[0-9]+\-[0-9]+\-[0-9]+_", "";
Rename-Item $oldname $newname;
@wilwang
wilwang / gist:4771a60f427fca97dd8dec3eabbae095
Created July 15, 2016 22:28
Powershell - Loop through sub directories and look for and rename file
$targDir = "C:\inetpub\websites\ADA*\";
$subDir = $(Get-ChildItem "$targDir");
foreach($sub in $subDir) {
$files = $(Get-Childitem $sub -Filter app_offline*.htm);
foreach($file in $files) {
$oldname = $file.FullName;
@LindaLawton
LindaLawton / GmailSendMail.psi
Last active December 6, 2021 05:18
Step by step guild to using power shell to get a Google access token.
clear-host;
#Remove-Variable * -ErrorAction SilentlyContinue
#get-item Variable:*
#Get-Variable | Select-Object -ExpandProperty Name
. C:\Users\linda_l\Desktop\PowerShell\GoogleOauth.ps1
Add-Type -Path "C:\Users\linda_l\Documents\visual studio 2015\Projects\TestingLibrary\packages\AE.Net.Mail.1.7.10.0\lib\net45\AE.Net.Mail.dll"
Add-Type -AssemblyName System.IO
Add-Type -AssemblyName System.Text.Encoding
@rkuzsma
rkuzsma / WaitFor.java
Created December 30, 2016 03:54
Java utility class to wait for ports and URL responses to be available
/**
* General utilities to wait for ports and URL responses to be available.
* Especially useful when waiting for container services to be fully "up".
*/
public class WaitFor {
private static final Logger logger = LoggerFactory.getLogger(WaitFor.class.getClass());
public static void waitForPort(String hostname, int port, long timeoutMs) {
logger.info("Waiting for port " + port);
@mrk-han
mrk-han / emulator-install-using-avdmanager.md
Last active July 11, 2024 01:51
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For an emulator that mimics a Pixel 5 Device with Google APIs and ARM architecture (for an M1/M2 Macbook):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-30;google_atd;arm64-v8a"

@biwkf
biwkf / gist:b0ebb9940e6341ed5e588f148b4381a8
Created February 27, 2019 15:10
Automating deeplinks with Appium on iOS real device
/* On a real device it is not possible to simply call driver.get("url"), doing so will open SIRI and query with "url" resulting in a search.
Instead we can take advantage of Safari's launch parameters and pass deep link URL as argument.
Below is an example: */
String deepLinkURL = "deeplink://";
driver.executeScript("mobile: terminateApp", ImmutableMap.of("bundleId", "com.apple.mobilesafari"));
List args = new ArrayList();
@badsyntax
badsyntax / android_emulator_cli_ci.md
Last active May 3, 2024 04:01
start an android emulator with screen dimensions (specifically for use in CI)
# Install AVD files
yes | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-29;default;x86'
yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses

# Create emulator
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_29_AOSP -d pixel --package 'system-images;android-29;default;x86' --force

$ANDROID_HOME/emulator/emulator -list-avds