Skip to content

Instantly share code, notes, and snippets.

@rafpro
rafpro / wp-config.php
Created March 13, 2024 17:43 — forked from MikeNGarrett/wp-config.php
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
#!/usr/bin/env bash
# The script installs Dotfiles on a system managed by Git Bare Repository technique.
# The inspiration of this script and management of dotfiles comes from
# @see https://www.atlassian.com/git/tutorials/dotfiles
# The code below is taken from here with some modification
RED="\033[31m"
GREEN="\033[32m"
@rafpro
rafpro / managing-the-gpg-agent.md
Created November 5, 2023 07:04 — forked from CMCDragonkai/managing-the-gpg-agent.md
Managing the gpg-agent #nix #gpg

Managing the gpg-agent

These are the standard commands:

gpgconf --list-dirs
gpgconf --kill gpg-agent
gpgconf --reload gpg-agent
@rafpro
rafpro / instructions.md
Created October 30, 2023 11:30 — forked from matthewjberger/instructions.md
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache

@rafpro
rafpro / gist:702b8d6dcd23bdb5f58f5c8629a03794
Created October 7, 2023 07:49 — forked from hellerbenjamin/gist:b2f20963f93ac394a840c4aa2d57ba42
Woocommerce Subscriptions WP CLI cheatsheet
Woocommerce Subscription WP CLI Cheatsheet
Reviews
Enable Reviews on all
wp db query 'UPDATE wp_posts SET comment_status="open" WHERE post_type="product" AND comment_status="closed"'
Query disabled reviews
wp db query 'SELECT ID FROM wp_posts WHERE post_type="product" AND comment_status="closed" AND post_status="publish"'
@rafpro
rafpro / fetch_page.py
Created May 16, 2023 16:29 — forked from Smerity/fetch_page.py
An example of fetching a page from Common Crawl using the Common Crawl Index
import gzip
import json
import requests
try:
from cStringIO import StringIO
except:
from StringIO import StringIO
# Let's fetch the Common Crawl FAQ using the CC index
resp = requests.get('http://index.commoncrawl.org/CC-MAIN-2015-27-index?url=http%3A%2F%2Fcommoncrawl.org%2Ffaqs%2F&output=json')
@rafpro
rafpro / run-multiple-redis-instances.md
Created January 19, 2023 01:42 — forked from akhdaniel/run-multiple-redis-instances.md
run multiple redis instances on the same server for centos

Run Multiple Instances of Redis on Centos 7

create a new redis .conf file

$ cp /etc/redis.conf /etc/redis-xxx.conf
$ sudo chown redis:redis /etc/redis-xxx.conf

edit /etc/redis-xxx.conf, illustrated as below

@rafpro
rafpro / jwtES384.sh
Created December 27, 2022 03:13 — forked from bencmbrook/jwtES384.sh
How to generate JWT ES384 key
# ECDSA using P-384 and SHA-384 (NIST curve, part of CNSA Suite, and approved to protect "top secret" systems)
# https://apps.nsa.gov/iaarchive/library/ia-guidance/ia-solutions-for-classified/algorithm-guidance/commercial-national-security-algorithm-suite-factsheet.cfm
# https://tools.ietf.org/html/rfc7518#section-3.4
# Generate private key
openssl ecparam -name secp384r1 -genkey -noout -out jwtES384key.pem
# Generate public key
openssl ec -in jwtES384key.pem -pubout -out jwtES384pubkey.pem
@rafpro
rafpro / mysql2sqlite.sh
Created December 24, 2022 21:49 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@rafpro
rafpro / curl.md
Created November 7, 2022 14:13 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.