Skip to content

Instantly share code, notes, and snippets.

View michaelbukachi's full-sized avatar

Michael Bukachi michaelbukachi

View GitHub Profile
@CoachBirgit
CoachBirgit / divi-sticky-footer.css
Last active January 6, 2018 02:11
CSS: Sticky footer - Elegantthemes Divi
@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;
@mekza
mekza / countries.py
Last active December 23, 2022 23:04
WTForms Select Field for country
from wtforms import SelectField
import pycountry
class CountrySelectField(SelectField):
def __init__(self, *args, **kwargs):
super(CountrySelectField, self).__init__(*args, **kwargs)
self.choices = [(country.alpha_2, country.name) for country in pycountry.countries]
@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
@santiagobasulto
santiagobasulto / gist:3056999
Created July 5, 2012 23:05
Mocking private methods in python
""" This is a simple gist to show how to mock
private methods. I've got lots of questions
regarding this topic. Most people seems confused.
Hope it helps.
"""
import unittest
import mock
@gilbitron
gilbitron / .env.travis
Last active August 12, 2023 08:06
Laravel 5 Travis CI config
APP_ENV=testing
APP_KEY=SomeRandomString
DB_CONNECTION=testing
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
@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:
@betrcode
betrcode / README.md
Created June 24, 2014 06:36
Using Python to check if remote port is open and accessible.
@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: