Skip to content

Instantly share code, notes, and snippets.

View sobujbd's full-sized avatar

Sobuj sobujbd

  • Bangladesh
View GitHub Profile
@sobujbd
sobujbd / android-select-device.sh
Created October 15, 2018 17:33
Select Android Devices Serial for ADB
#!/bin/bash
# selects an android device
PROGNAME=$(basename $0)
UNAME=$(uname)
DEVICE_OPT=
for opt in "$@"
do
case "$opt" in
@sobujbd
sobujbd / batch image convert (imagemagick).sh
Created March 14, 2019 14:21
batch image convert (imagemagick)
#!/usr/bin/env bash
magick convert *.jpg -set filename:basename "%[basename]" "%[filename:basename].png"
@sobujbd
sobujbd / wp_db_create_backup.sh
Created April 8, 2019 14:54 — forked from LostinOrchid/wp_db_create_backup.sh
Create database backup in Wordpress
#!/usr/bin/env bash
sqllocation=~/.sql_backup_files
# echo $(wp --version)
wp --version >/dev/null 2>&1 || {
echo "I need 'wp' command to be able to execute further"
exit 1
}
# Check if it is a wordpress directory or is installed
@sobujbd
sobujbd / wp-cli-create.sh
Created April 8, 2019 14:54 — forked from oxocode/wp-cli-create.sh
wp-cli-create
#!/bin/bash
# Setup Variables
DBNAME=dbname
DBUSER=dbuser
DBPASS=dbpass
DBHOST=localhost
DBPREFIX=oxo_
URL=http://
@sobujbd
sobujbd / set-value.md
Created June 1, 2019 04:25 — forked from JeffreyWay/set-value.md
PHP: Set value if not exist

You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:

name = name || 'joe';

This is quite common and very helpful. Another option is to do:

name || (name = 'joe');
@sobujbd
sobujbd / wpcli-wp-install.sh
Created July 25, 2019 02:30
One-Click WordPress Installer
#!/bin/bash
# Setup Variables
DBNAME=database_name
DBUSER=database_user
DBPASS=database_password
#DBHOST=localhost
#DBPREFIX=gits_
URL=domain_name
@sobujbd
sobujbd / csv-to-json.php
Created July 30, 2019 05:53 — forked from robflaherty/csv-to-json.php
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@sobujbd
sobujbd / README.md
Created July 16, 2020 13:02 — forked from mbleigh/README.md
Firebase Hosting Fetch All Files

Fetch All Files from Firebase Hosting

This script fetches all of the files from the currently deployed version of a Firebase Hosting site. You must be signed in via the Firebase CLI and have "Site Viewer" permission on the site in question to be able to properly run the script.

Running via NPX

npx https://gist.github.com/mbleigh/9c8680cf319ace2f506f57380da66e7d <site_name>
@sobujbd
sobujbd / Mark parent navigation active when on custom post type single page Mark (highlight) custom post type parent as active item in Wordpress Navigation.When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
<?php
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Get post ID, if nothing found set to NULL
$id = ( isset( $post->ID ) ? get_the_ID() : NULL );
{
"info": {
"name": "BDWebs WHMCS",
"version": "1.0.0",
"download_link": "https://github.com/appsforbd/bdwebs-whmcs-monitoring/releases/latest"
},
"links": [
{
"title": "BDWebs.com",
"link": "https://www.bdwebs.com/"