Skip to content

Instantly share code, notes, and snippets.

View david-kariuki's full-sized avatar
👨‍💼
Engineering

David Kariuki (DK) david-kariuki

👨‍💼
Engineering
View GitHub Profile
@david-kariuki
david-kariuki / git-delete-branches-older-than-period
Last active February 23, 2023 11:39
This is an automated bash script to delete git branches older than some specific time period. The default set time is 3 months, but you can pass the period in months as a first parameter while running the shell script. The script will by default exclude master and main and development branch. You can add more
#!/bin/sh
:'
This is an automated bash script to delete git branches older than some specific time period.
The default set time is 3 months, but you can pass the period in months as a first parameter while running the shell script
'
declare -i numberOfMonths=3 # Declare the default period in months
declare blackListedBranches # Blacklisted branches
clear=clear # Command to clear terminal
ECHO='echo ' # Custom echo
@zobayer1
zobayer1 / fedora_install_python3.md
Last active September 14, 2024 09:43
Install Python 3.6, 3.7, 3.8 in your Fedora system

Python 3.9 comes as a default with Fedora 34. However, sometimes you may wish to install older versions for development and test purposes. Apart from groupinstall command, these instructions work for CentOS and REHL systems as well.

Prerequisites

Install python development dependencies.

sudo dnf groupinstall "Development Tools"
sudo dnf install python3-devel openssl-devel zlib-devel bzip2-devel sqlite-devel libffi-devel

Note: You will need to rebuild and reinstall if you install new source or development libraries for python. Do not create or modify symlinks for python, python3, etc, as that may and will break many dependent libraries in your system.

@danieldogeanu
danieldogeanu / MakePowerShellRememberSSHPassphrase.md
Last active October 31, 2024 20:59
How to make Powershell remember the SSH key passphrase.

You should not use the Open SSH client that comes with Git for Windows. Instead, Windows 10 has its own implementation of Open SSH that is integrated with the system. To achieve this:

  1. Start the ssh-agent from Windows Services:
  • Type Services in the Start Menu or Win+R and then type services.msc to launch the Services window;
  • Find the OpenSSH Authentication Agent in the list and double click on it;
  • In the OpenSSH Authentication Agent Properties window that appears, choose Automatic from the Startup type: dropdown and click Start from Service status:. Make sure it now says Service status: Running.
  1. Configure Git to use the Windows 10 implementation of OpenSSH by issuing the following command in Powershell:
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
@lopspower
lopspower / KeyboardUtils.java
Last active July 6, 2023 13:35
Force Hide Keyboard Android
import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
public class KeyboardUtils {
public static void hideKeyboard(Activity activity) {
View view = activity.findViewById(android.R.id.content);
@e7d
e7d / sample.sh
Last active May 11, 2024 13:46
Bash "try catch"
#!/bin/bash
export AnException=100
export AnotherException=101
# start with a try
try
( # open a subshell !!!
echo "do something"
[ someErrorCondition ] && throw $AnException