Apache flags, sorted by frequency of use (more common at the top)
- Perform an HTTP redirect
- Default is a temporary
302
redirect - Always use with an
L
- e.g.,
[L,R=301]
- Break if the rule matches, i.e. don't process subsequent rules
function strToHex(str) { | |
return Array.from(str).map(char => | |
char.codePointAt(0).toString(16).padStart(4, '0') | |
).join(''); | |
} | |
function hexToStr(hex) { | |
let result = ''; | |
for (let i = 0; i < hex.length; i += 4) { | |
result += String.fromCharCode(parseInt(hex.substring(i, i + 4), 16)); |
#!/usr/bin/env bash | |
# A script that forces a target npm workspace to symbolically link to any root node_modules that it does not explicitly contain | |
# Example usage: ./scripts/npm-symlink.sh packages/website | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
WORKSPACE="$1" |
function countMentionAndCommentEmails() { | |
var query = 'from:[email protected] is:unread'; | |
var start = 0; | |
var max = 200; | |
var allThreads = []; | |
while (true) { | |
var threads = GmailApp.search(query, start, max); | |
if (threads.length === 0) { | |
break; |
/** | |
*** Aggregate Gmail Unreads | |
*** | |
*** A Google Apps Script for counting and sorting through unread emails | |
*** Works for both Gmail and Google Apps aka GSuite aka Google for Work aka Google Workspace | |
*** ES5 syntax must be used for .gs files, do not use ES6 or higher notation | |
*** | |
*** Usage: go to script.google.com, create a new project, save and run this script, authenticate, and wait (< 6 minutes) | |
*** | |
**/ |
#!/bin/bash | |
LIBS_ZIP_URL="http://bsr43.free.fr/scummvm/ScummVM-iOS-libraries.zip" | |
GIT_REPO_URL="https://github.com/scummvm/scummvm.git" | |
# Clone the repository | |
git clone "$GIT_REPO_URL" | |
# Compile create_project | |
(cd scummvm/devtools/create_project/xcode; xcodebuild) |
<?php | |
// Redirect an attachment page to its parent. Opening the actual attachments is still valid | |
add_action( 'template_redirect', 'void_attachment_parent', 1 ); | |
if (!function_exists('void_attachment_parent')) : | |
function void_attachment_parent() { | |
global $post; | |
if ( is_attachment()): | |
// Optionally check file type and perform redirect for some files only. |
#### Find and append a newline to all files that do not already have one | |
## Regular operation for most *nix | |
find ~/my-path/ -type f -exec sed -i -e '$a\' {} \; | |
## MacOS compatible sed | |
find ~/my-path/ -type f -exec sed -i '' -e '$a\' {} \; | |
## (for find commands, consider controlling the nesting level with max-depth) |
""" A minimal, portable vi configuration, use in ~/.exrc or ~/.vimrc """ | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
function! ResetOsTheme() | |
" Detect current macOS theme | |
let l:os_theme = system("defaults read -g AppleInterfaceStyle 2> /dev/null") | |
" Adjust Vim settings based on macOS theme | |
if l:os_theme == "Dark\n" |
#!/bin/bash | |
# | |
# run with: | |
# ./wp_perms.sh {path} | |
# | |
OWNER=apache # Wordpress owner, or the user that runs php. On CentOS/Redhat this is usually apache. On Ubuntu/Debian, this could be www-data | |
GROUP=apache # Configure your own group, or use the group from the user above (apache, www-data, etc.) | |
ROOT=$1 # Specify path when invoking this script | |
# Reset permissions to defaults |