Skip to content

Instantly share code, notes, and snippets.

@jopfre
jopfre / bash loop
Last active February 8, 2021 13:37
for file in ./*.png;
do
if grep -q ${file:2} ./fileslist.txt;
then
echo "skipping $file"
else
echo "moving $file"
mv "$f" ./newdir
fi
done
@jopfre
jopfre / OSOpenSpace.js
Created December 17, 2018 02:24
os-leaflet with 250px tiles
/**
* os-leaflet ; A [Leafletjs](http://leafletjs.com/) TileLayer to display Ordnance Survey
* data in your Leaflet map via the OS OpenSpace web map service.
*
* https://github.com/rob-murray/os-leaflet
*/
(function (root, factory) {
// UMD for Node, AMD or browser globals
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
ffmpeg -i input.mp4 -strict -2 -movflags faststart -vcodec libx264 -crf 24 output.mp4
https://www.facebook.com/sharer/sharer.php?u=
https://www.linkedin.com/shareArticle?mini=true&url=http://google.com&title=Google%20dot%20com&summary=Google%20home%20&source=LinkedIn
https://twitter.com/intent/tweet?text=ENCODEDTEXT&url=ENCODEDURL
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html [NC,L]
DirectoryIndex index.html index.php
$query="SELECT * FROM word WHERE day = current_date() LIMIT 1";
$result = mysql_query($query);
if ($result) {
// echo "Query executed";
$row = mysql_fetch_assoc($result);
$word = $row['word'];
$definition = $row['definition'];
$definitionB = $row['definitionB'];
} else {
echo "Query not executed";
#http://stackoverflow.com/a/27029144
RewriteEngine On
# match any URL with www and rewrite it to https without the www
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
# match urls that are non https (without the www)
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www\.)(.*) [NC]
@jopfre
jopfre / point-domain-to-different-host.txt
Last active July 7, 2016 14:02
Point a domain from one domain provider (tsohost) to a different host
Set A record for blank (root) to ip
Set A record for www to ip - in tso this is done by selecting the www domain from the drop down
Set MX record to mail.domain-name.com
Set TTL to 300 for all (may only apply to TSO domain providings, ask other providers for their nameservers TTL)
@jopfre
jopfre / gist:ffd0153015a791ee25dc14e6cec825f6
Created June 23, 2016 12:52
Add Timestamp to WordPress Child Theme Stylesheet to invalidate cache
function add_timestamp_to_childtheme_stylesheet() {
wp_dequeue_style( 'style' );
wp_deregister_style( 'style' );
wp_enqueue_style('style', get_stylesheet_uri().'?'.filemtime(get_stylesheet_directory().'/style.css'), array(), null);
}
add_action( 'wp_print_styles', 'add_timestamp_to_childtheme_stylesheet' );
AddType image/svg+xml svg svgz
AddEncoding gzip svgz