Skip to content

Instantly share code, notes, and snippets.

View anver's full-sized avatar
🏠
Working from home

Anver Sadutt anver

🏠
Working from home
View GitHub Profile
@anver
anver / migrate_from_exist_hitory.sh
Created June 20, 2023 11:36 — forked from exdeniz/migrate_from_exist_hitory.sh
Remove Duplicate zsh History
cat -n .zsh_history | sort -t ';' -uk2 | sort -nk1 | cut -f2- > .zhistory
@anver
anver / HdWallet.php
Created December 8, 2021 01:38 — forked from daftspunk/HdWallet.php
PHP library for generating addresses from an XPUB
<?php
use BitWasp\Bitcoin\Bitcoin;
use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeyFactory;
use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeySequence;
use BitWasp\Bitcoin\Key\Deterministic\MultisigHD;
use BitWasp\Bitcoin\Network\NetworkFactory;
use Exception;
/*
@anver
anver / gutenberg-audit.php
Created November 17, 2021 10:06 — forked from hughc/gutenberg-audit.php
Gutenberg Audit for WordPress
<?php
/*
Plugin Name: Gutenberg Audit
Plugin URI: http://highbrow.com.au/plugins/gutenberg-audit
description: What blocks is your site using?
Version: 0.1
Author: Hugh Campbell
Author URI: http://highbrow.com.au/
License: GPL2
*/
@anver
anver / list_blocks.js
Created November 16, 2021 11:28 — forked from techlemur/list_blocks.js
get all available gutenberg block info for your site with javascript
/* Navigate to a wordpress edit page for any post and run one of the code sections below in a javascript console to get the names/info for all blocks available to gutenberg on your site. */
/* log all block info to console */
console.log(wp.data.select( "core/blocks" ).getBlockTypes());
/* log all block names to console */
wp.data.select( "core/blocks" ).getBlockTypes().forEach(function(element) {
console.log(element['name']);
});
@anver
anver / git-copy-file-history.sh
Created April 24, 2021 06:27 — forked from joeyates/git-copy-file-history.sh
Copy a commits from one Git repo to another
# Copy all modifications to a file from one repo to another
for c in `git --git-dir=../path/to/repo/.git log --reverse --pretty=tformat:"%H" -- path/to/file`; do
git --git-dir=../path/to/repo/.git format-patch --keep-subject -1 --stdout $c | git am --3way --keep;
done
@anver
anver / git-rsync.sh
Created April 23, 2021 20:53 — forked from mityukov/git-rsync.sh
Sync only files, added or modified since last commit
#!/bin/bash
## Installation:
# - make a file, called `git-rsync` in a directory, covered by your $PATH variable;
# - `chmod a+x` this file.
# - do the same for `listfiles` script
#
## Usage:
# 1. Syncing "dirties" (all the files you can see in the `git status` output)
# - before commiting, issue `git-rsync login@host:/destination/path/` command to sync all local changes to your stage server
@anver
anver / launch.json
Created February 21, 2021 17:17 — forked from jarshwah/launch.json
Webpack Source Maps with vscode debugging
// debug config for running project under vscode debugger
{
"version": "0.2.0",
"configurations": [
{
"trace": true,
"name": "Chrome Debug",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8000/",
@anver
anver / ubuntu_install.sh
Created December 10, 2020 19:07 — forked from nginx-gists/ubuntu_install.sh
Automating Installation of WordPress with NGINX Unit on Ubuntu
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ];then
>&2 echo "This script requires root level access to run"
exit 1
fi
if [ -z "${WORDPRESS_DB_PASSWORD}" ]; then
>&2 echo "WORDPRESS_DB_PASSWORD must be set"
>&2 echo "Here is a random one that you can paste:"
@anver
anver / elementorcssinhead.php
Created September 24, 2020 21:03 — forked from nicomollet/elementorcssinhead.php
Load Elementor styles on all pages in the head to avoid CSS files being loaded in the footer
<?php
/**
* Load Elementor styles on all pages in the head to avoid CSS files being loaded in the footer
*/
function elementor_css_in_head(){
if(class_exists('\Elementor\Plugin')){
$elementor = \Elementor\Plugin::instance();
$elementor->frontend->enqueue_styles();
}
if(class_exists('\ElementorPro\Plugin')){
@anver
anver / functions.php
Created June 13, 2018 18:34 — forked from tripflex/functions.php
WordPress Recursively get taxonomy hierarchy (courtesy of http://www.daggerhart.com/wordpress-get-taxonomy-hierarchy-including-children/ )
<?php
/**
* Recursively get taxonomy hierarchy
*
* @source http://www.daggerhart.com/wordpress-get-taxonomy-hierarchy-including-children/
* @param string $taxonomy
* @param int $parent - parent term id
*
* @return array