Skip to content

Instantly share code, notes, and snippets.

🚀
Don't tell me the sky is the limit when there are footprints on the moon

Cedric Kastner nurtext

🚀
Don't tell me the sky is the limit when there are footprints on the moon
Block or report user

Report or block nurtext

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nurtext
nurtext / additional_queries.sql
Last active Jan 8, 2019 — forked from jashk/wp_offload_media_db_migrate.json
Migrate a WordPress database so that existing media items are served from Amazon S3 or CloudFront. Requires the WP Offload S3 Lite plugin.
View additional_queries.sql
--- Updated queries for a bedrock-setup which doesn't use the default path settings
UPDATE wp_posts SET post_content = REPLACE(post_content, 'href="https://your-domain.tld/app/uploads/', 'href="https://your-cdn-url.tld/');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'src="https://your-domain.tld/app/uploads/', 'src="https://your-cdn-url.tld/');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'https://your-domain.tld/app/uploads/', 'https://your-cdn-url.tld/');
-- Plugins/Themes that use wp_options to store settings like logo file, etc.
UPDATE wp_options SET option_value = REPLACE(option_value, 'https://your-domain.tld/app/uploads/', 'https://your-cdn-url.tld/');
--- VisualComposer custom CSS
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'https://your-domain.tld/app/uploads/', 'https://your-cdn-url.tld/') WHERE meta_key = '_wpb_shortcodes_custom_css';
@nurtext
nurtext / .htaccess
Last active Jul 17, 2019
Tell apache we're on HTTPS if reverse proxy is serving the site using SSL
View .htaccess
# Let apache know we're behind a SSL reverse proxy
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
# Redirect to HTTPS
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IFModule>
@nurtext
nurtext / queue.h
Created Jun 7, 2015
sys/queue.h from gcc420_glibc236_x64_bromolow-GPL.tgz
View queue.h
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@nurtext
nurtext / wp-migrate.sh
Created Oct 6, 2014
Migrate Wordpress using wp-cli
View wp-migrate.sh
#!/bin/bash
# Check if wp-cli is installed
command -v wp >/dev/null 2>&1 || { echo >&2 "wp-cli not found. Visit http://wp-cli.org for more details."; exit 1; }
# Show usage info if wrong argument count
if [ $# -ne 2 ]; then
printf "WordPress migration script\n\n"
printf "Usage:\n"
printf " migrate.sh <from url> <to url>\n\n"
View keybase.md

Keybase proof

I hereby claim:

  • I am nurtext on github.
  • I am nurtext (https://keybase.io/nurtext) on keybase.
  • I have a public key whose fingerprint is 2E24 B2EC 678A E429 6488 0477 5286 0A8C 6B1C 2706

To claim this, I am signing this object:

@nurtext
nurtext / accordion.html
Created Oct 22, 2013
Simple CSS3 based horizontal accordion
View accordion.html
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>CSS3 Accordion</title>
<style>
#accordion {
width: 810px;
height: 600px;
margin: 20px auto;
@nurtext
nurtext / shorthand_return_values.php
Last active Dec 26, 2015
Shorthand return values without variable assignment
View shorthand_return_values.php
<?php
// Example class
class Hello
{
// Just a simple function wich returns a string
public function World($name = 'World')
{
return sprintf("Hello %s\n", $name);
}
@nurtext
nurtext / fonts.jsx
Created Apr 24, 2013
Javascript to list all fonts used within a Photoshop document. May take a while on large documents to finish…
View fonts.jsx
#target photoshop
function sort_unique(arr)
{
arr = arr.sort();
var ret = [arr[0]];
for (var i = 1; i < arr.length; i++)
{
if (arr[i-1] !== arr[i]) { ret.push(arr[i]); }
@nurtext
nurtext / tomorrow.php
Last active Dec 16, 2015
Get tomorrow's date
View tomorrow.php
<?php
// Optional
date_default_timezone_set('Europe/Berlin');
// Set the date to tomorrow (midnight)
$tomorrow = new DateTime('tomorrow');
// Print the result
print_r($tomorrow);
@nurtext
nurtext / brothers_in_binary.php
Last active Dec 16, 2015
This code sample tries to find perfect numbers using the „Brothers in Binary“ theorem. For more information visit: http://www.futilitycloset.com/2013/04/09/brothers-in-binary/
View brothers_in_binary.php
<?php
// Loop until the 20th binary digit of 0
for ($bin = 1; $bin < 20; $bin++)
{
// 1 has always one digit more than 0
$bin_str = str_repeat('1', $bin +1) . str_repeat('0', $bin);
// Convert binary to decimal
$dec = bindec($bin_str);
You can’t perform that action at this time.