Skip to content

Instantly share code, notes, and snippets.

View michaelbukachi's full-sized avatar

Michael Bukachi michaelbukachi

View GitHub Profile
@3dprogramin
3dprogramin / selenium-cookies-importer.py
Last active January 5, 2024 19:51
Import cookies from text file into selenium webdriver
from selenium import webdriver
from time import sleep
# read cookies from file
# format
# ... expiry1 key1 value1
# ... expiry2 key2 value2
def read_cookies(p = 'cookies.txt'):
cookies = []
with open(p, 'r') as f:
@kairos34
kairos34 / ZipManager
Created March 19, 2019 15:06
Kotlin zip and unzip functions
object ZipManager {
fun zip(files: List<File>, zipFile: File) {
ZipOutputStream(BufferedOutputStream(FileOutputStream(zipFile))).use { output ->
files.forEach { file ->
(file.length() > 1).ifTrue {
FileInputStream(file).use { input ->
BufferedInputStream(input).use { origin ->
val entry = ZipEntry(file.name.toRealName())
output.putNextEntry(entry)
@satishgunjal
satishgunjal / wifissid.py
Created October 14, 2018 07:20
Get connected wifi SSID using python on Raspberry pi
import subprocess
try:
output = subprocess.check_output(['sudo', 'iwgetid'])
print("Connected Wifi SSID: " + output.split('"')[1])
except Exception, e:
print e
@zironycho
zironycho / portainer-agent-stack-traefik.yml
Last active June 30, 2019 23:00
portainer stack with traefik
version: '3.2'
services:
agent:
image: portainer/agent
environment:
# REQUIRED: Should be equal to the service name prefixed by "tasks." when
# deployed inside an overlay network
AGENT_CLUSTER_ADDR: tasks.agent
# AGENT_PORT: 9001
@jdsingh
jdsingh / RealmBackupRestore.java
Created July 3, 2017 12:57 — forked from paolorotolo/RealmBackupRestore.java
Class to easily backup/restore data from Realm.
package org.glucosio.android.tools;
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Environment;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import android.widget.Toast;
@ziadoz
ziadoz / install.sh
Last active April 20, 2024 10:18
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
@GabLeRoux
GabLeRoux / env-to-json.py
Last active September 10, 2023 00:45
.env file to json using simple python
#!/usr/bin/env python
import json
import sys
try:
dotenv = sys.argv[1]
except IndexError as e:
dotenv = '.env'
with open(dotenv, 'r') as f:
@rgl
rgl / wait_for_http_200.sh
Last active March 7, 2024 17:08
Wait for an HTTP endpoint to return 200 OK with Bash and curl
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done'
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76
@mrkpatchaa
mrkpatchaa / README.md
Last active April 4, 2024 09:37
Bulk delete github repos

Use this trick to bulk delete your old repos or old forks

(Inspired by https://medium.com/@icanhazedit/clean-up-unused-github-rpositories-c2549294ee45#.3hwv4nxv5)

  1. Open in a new tab all to-be-deleted github repositores (Use the mouse’s middle click or Ctrl + Click) https://github.com/username?tab=repositories

  2. Use one tab https://chrome.google.com/webstore/detail/onetab/chphlpgkkbolifaimnlloiipkdnihall to shorten them to a list.

  3. Save that list to some path

  4. The list should be in the form of “ur_username\repo_name” per line. Use regex search (Sublime text could help). Search for ' |.*' and replace by empty.

@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm