Skip to content

Instantly share code, notes, and snippets.

@uchagani
uchagani / ClientFactory.java
Created July 21, 2023 21:41
Ignore SSL OKHTTP3 Configuration
// Add this when creating an OKHttp3 Client
var trustManager = new IgnoreSslTrustManager[]{new IgnoreSslTrustManager()};
var sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, trustManager, new java.security.SecureRandom());
var okHttpClient = clientBuilder.addInterceptor(new AuthenticationInterceptor())
.sslSocketFactory(sslContext.getSocketFactory(), trustManager[0])
.hostnameVerifier((hostname, session) -> true)
.build();
@uchagani
uchagani / Dockerfile
Created April 11, 2022 11:51
Playwright Dockerfile
FROM some-ubuntu-focal-based-image:latest
USER root
# === INSTALL JDK and Maven ===
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openjdk-11-jdk maven \
# Install utilities required for downloading browsers
@uchagani
uchagani / batch-mp3.txt
Created May 16, 2020 09:38 — forked from theodric/batch-mp3.txt
batch convert files from (e.g.) m4b to mp3 with ffmpeg and avconv
Single:
avconv -acodec libmp3lame -i test.m4b test.mp3
Batch:
for f in *m4b; do avconv -i "$f" -acodec libmp3lame ${f%.m4b}.mp3"; done
Single:
ffmpeg -i input.wav -codec:a libmp3lame -qscale:a 7 output.mp3
Batch:
@uchagani
uchagani / proxmox_usb_passthrough.md
Last active February 23, 2019 03:48
Proxmox USB Passthrough
@uchagani
uchagani / break.py
Created August 1, 2018 01:58 — forked from obfusk/break.py
python equivalent of ruby's binding.pry
import code; code.interact(local=dict(globals(), **locals()))
@uchagani
uchagani / install_selenium.bat
Created August 24, 2016 18:08
Install Selenium Server Node as a Windows Service
@echo off
:REM This will install Selenium Server Node as a Windows Service
set SERVICE_NAME=SeleniumServer
set SERVER_VERSION=2.42.2
set JAVA=%ProgramFiles%\Java\jre7\bin\java.exe
set NSSM=C:\selenium\nssm-2.16\win64\nssm.exe
set SERVER_JAR=C:\selenium\selenium-server-standalone-2.42.2.jar
set CONFIG=C:\selenium\node_config_windows.json
@uchagani
uchagani / selenium_grid.bat
Created August 24, 2016 16:47
selenium_grid.bat
#!/bin/bash
PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH
nohup java -jar /mnt/u02/home/username/selenium-server-standalone-2.41.0.jar -role hub -hubConfig /mnt/u02/home/username/hub_config.json > /mnt/u02/home/username/hub_log.log &
@uchagani
uchagani / solution1.md
Created October 25, 2015 19:57 — forked from MohammedJabarullah/solution1.md
Mac OS X: Docker/Boot2Docker CiscoVPN connection issue solution

Enable port forwarding on VirtualBox Machine from 2376 on host to 2376 on guest (Settings > Network > Adapter 1 NAT > Advanced > Port Forwarding), and then export the following in a shell. Docker Compose and other docker tools will work as expected.

export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://localhost:2376"

For docker-machine users:

@uchagani
uchagani / Vagrant.psm1
Created November 19, 2014 19:18
Vagrant Status In PowerShell
#Gets the vagrant status in returns it as a PowerShell Object
function Vagrant-Status
{
$output = vagrant status --machine-readable | Select-String -Pattern "state-human-short" -AllMatches
$output = $output | ? { $_ } | sort -uniq
$status = ConvertFrom-Csv $output -Header TimeStamp,Machine,StatusType,State
return $status
}
function RenameComputer($ComputerName)
{
$computer = Get-WmiObject -Class Win32_ComputerSystem
$computer.rename("$ComputerName")
Remove-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "Hostname"
Remove-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -name "NV Hostname"
New-PSDrive -name HKU -PSProvider "Registry" -Root "HKEY_USERS"