Skip to content

Instantly share code, notes, and snippets.

@techpulsetoday
techpulsetoday / ngxdis
Created December 21, 2018 17:48 — forked from fideloper/ngxdis
Nginx scripts for enable and disabling a site. This will create or destroy a symlink between a real config file in /etc/nginx/sites-available and a symlink in /etc/nginx/sites-enabled.
#!/usr/bin/env bash
if [ $EUID -ne 0 ]; then
echo "You must be root: \"sudo ngxdis\""
exit 1
fi
# -z str: Returns True if the length of str is equal to zero.
if [ -z "$1" ]; then
echo "Please choose a site."
@techpulsetoday
techpulsetoday / breadcrumbs-code-without-plugin.php
Last active June 11, 2021 14:23
By adding this to functions.php to display the menu, just use this function to display it wherever you want.
<?php
/*=============================================
BREADCRUMBS
=============================================*/
// to include in functions.php
function the_breadcrumb()
{
$showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show
$delimiter = '&raquo;'; // delimiter between crumbs
$home = 'Home'; // text for the 'Home' link
@techpulsetoday
techpulsetoday / how-to-execute-a-bash-script-from-github-gist.md
Last active December 11, 2023 08:12
Execute bash script directly from URL

Execute bash script directly from a URL

bash <(curl -Ls https://example.com/script.sh)
bash <(curl -Ls https://raw.githubusercontent.com/techpulsetoday/scripts/master/vim-bootstrap)

Passing Parameters to bash when executing a script fetched by curl

curl https://example.com/script.sh | bash -s arg1 arg2 arg3
curl https://raw.githubusercontent.com/techpulsetoday/scripts/master/virtualhost | sudo bash -s create local.techpulsetoday.com /var/www/html/local.techpulsetoday.com/
@techpulsetoday
techpulsetoday / .gitconfig
Last active January 8, 2019 11:24
.gitconfig
[user]
name = TechPulseToday
username = techpulsetoday
email = techpulsetoday@gmail.com
[init]
templatedir = ~/.git-templates
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
[web]
@techpulsetoday
techpulsetoday / WP-HTML-Compression
Created January 16, 2019 12:41 — forked from sethbergman/WP-HTML-Compression
Minify HTML for WordPress without a Plugin - Add to function.php
<?php
class WP_HTML_Compression
{
// Settings
protected $compress_css = true;
protected $compress_js = true;
protected $info_comment = true;
protected $remove_comments = true;
// Variables
<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) {
echo 'This is the last post';
} ?>
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) {
echo 'This is the not the last post';
} ?>
@techpulsetoday
techpulsetoday / .htaccess
Last active April 29, 2019 08:17
htaccess: Disable URL indexing by crawlers (FOR DEVELOPMENT/STAGE); Block Google and bots. (You can keep the file updated as new bots or IP need to be blocked)
# -----------------------------------------------------------------------------------------
# Disable URL indexing by crawlers (FOR DEVELOPMENT/STAGE)
# Block Google and bots
# -----------------------------------------------------------------------------------------
# Avoid search engines (Google, Yahoo, etc) indexing website's content
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} AltaVista [OR]
RewriteCond %{HTTP_USER_AGENT} Googlebot [OR]
@techpulsetoday
techpulsetoday / .htaccess
Created April 29, 2019 08:19
6G FIREWALL/BLACKLIST
# 6G FIREWALL/BLACKLIST
# @ https://perishablepress.com/6g/
# 6G:[QUERY STRINGS]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} (eval\() [NC,OR]
RewriteCond %{QUERY_STRING} (127\.0\.0\.1) [NC,OR]
RewriteCond %{QUERY_STRING} ([a-z0-9]{2000}) [NC,OR]
RewriteCond %{QUERY_STRING} (javascript:)(.*)(;) [NC,OR]
#!/bin/bash
# Author: Vijayan Jayaraman
# Publisher: https://techpulsetoday.com/
# Text Reset
RESET='\e[0m'
BLINK='\e[5m'
# Regular Colors
BLACK='\e[0;30m'
<?php
for ($i = 1; $i <= 100; $i++) {
$result = $i;
$check_linio = $i % 3;
$check_it = $i % 5;
while (!$check_linio) {
$result = "Linio";
break;
}