Skip to content

Instantly share code, notes, and snippets.

View hihabib's full-sized avatar

Habibul Islam hihabib

  • Dhaka, Bangladesh
View GitHub Profile
@wpscholar
wpscholar / create-admin-user.php
Last active February 27, 2024 11:54
Create a new admin user in WordPress via code. Drop this file in the mu-plugins directory and update the variables, then load a page in WordPress to create the user. Remove the file when done.
<?php
add_action( 'init', function () {
$username = 'admin';
$password = 'password';
$email_address = 'webmaster@mydomain.com';
if ( ! username_exists( $username ) ) {
$user_id = wp_create_user( $username, $password, $email_address );
@RafalJDev
RafalJDev / CountYoutubeVideosTime.js
Last active April 11, 2024 00:42
Count all videos time duration on youtube channel
//You need to run this in javascript console inside chrome
//Assumptions:
//1. Will count only "expanded" videos on page, you may first need to run script to scroll to last video or do it manually
//2. Tested on chrome, ubuntu, 2019
//3. Time format: hh:mm:ss
var array = document.getElementsByClassName("style-scope ytd-thumbnail-overlay-time-status-renderer");
var arrLength = array.length;