Skip to content

Instantly share code, notes, and snippets.

#monitor files in "webserver-access" folder
watch ls -l webserver-access
#taken from here: https://community.playstarbound.com/threads/synchronize-savegames-between-windows-mac-and-linux.53217/
cd /Users/milojennings/Library/Application\ Support/Steam/steamapps/common/Starbound/storage
ln -s /Users/milojennings/Dropbox/User\ Account\ Settings/Starbound/player player
ln -s /Users/milojennings/Dropbox/User\ Account\ Settings/Starbound/universe universe

Modified version of the code found in this post

{% set export = blog_recent_posts('2099729350', 200) %} 
"post_title","post_slug","post_date","post_content","post_thumbnail","post_author","post_category",<br>
{% for content in export %} "{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.name|forceescape }}","{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.slug|forceescape|replace('blog/', '') }}","{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.publish_date_localized|forceescape }}","{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.post_body|replace('"','""')|forceescape|escape_jinjava }}","{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.featured_image }}","{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.blog_post_author }}","{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.topic_list|forceescape|replace('[', '')|replace(']', '') }}" <br>
{% endfor %}
{% endif %}
@facelordgists
facelordgists / curl-website-from-specific-host.sh
Last active September 3, 2019 20:23
Curl a website from one server to another within a private network, such as a gateway to appserver or loadbalancer to appserver.
# -H sets the header
# -v includes the header information
# /dev/null pipes the contents of the page output into a blackhole
curl -v http://<server-host_or_ip>/ -H "Host: domain.com" > /dev/null
# Example
curl -v https://localhost/ -H "Host: www.dentalmanagers.com" > /dev/null
curl -v http://appserver-4/ -H "Host: www.1111dental.com" > /dev/null
curl -v http://appserver-4/ -H "Host: test.roadsidedentalmarketing.com" > /dev/null
git clone https://github.com/interconnectit/Search-Replace-DB.git
# You also need to provide the host, database name, username, password, etc...
# I'm too lazy to put this together right now.
php srdb.cli.php -s "http://www.nelsonsmiles.com" -r "https://www.nelsonsmiles.com" --dry-run
@facelordgists
facelordgists / run script as another user.sh
Last active March 20, 2019 21:29
how to run a script or command as a different user in the terminal who doesn't have a login (nginx and www-data are common examples).
# run as nginx
su nginx -s /bin/bash -c "php -f script.php"
su nginx -s /bin/bash -c '/path/to/your/script'
# run as testuser
su -s /bin/bash -c '/path/to/your/script' testuser

Edit fstab from the terminal

sudo nano /etc/fstab

Add the following line (replace NAME with the drive name, ensuring the drive name has no spaces)

LABEL=NAME none ntfs rw,auto,nobrowse

<?php
// https://www.elegantthemes.com/blog/tips-tricks/using-the-wordpress-debug-log
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
if ( ! function_exists('write_log')) {
function write_log ( $log ) {
if ( is_array( $log ) || is_object( $log ) ) {
error_log( print_r( $log, true ) );

Standard string search

ack 

Limit search to specific file type

.php files