Skip to content

Instantly share code, notes, and snippets.

View sobujbd's full-sized avatar

Sobuj sobujbd

  • Bangladesh
View GitHub Profile
@sobujbd
sobujbd / acmedns.sh
Created July 25, 2022 00:55
Run joohoi ACME DNS with Docker using different HTTP port.
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
start_acme_dns()
{
sudo docker run --rm --name acmedns -p 53:53 -p 53:53/udp -p 8443:80 -v /path/to/your/acme-dns/config:/etc/acme-dns:ro -v /path/to/your/acme-dns/data:/var/lib/acme-dns -d joohoi/acme-dns
}
{
"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/"
@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 );
@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 / 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 / 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 / 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 / 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 / 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 / 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"