Skip to content

Instantly share code, notes, and snippets.

View rollecode's full-sized avatar
🔥
on fire! 🔥🔥🔥

Rolle Laukkarinen rollecode

🔥
on fire! 🔥🔥🔥
View GitHub Profile
@Jany-M
Jany-M / wp_weekly_cal.php
Last active February 14, 2026 22:03
[WP] Custom WordPress weekly dynamic calendar, with custom post types, custom date fields and caching
<div id="calendar">
<?php
// Dates
// See also https://datatracker.ietf.org/doc/html/rfc5545
$year = date('Y');
$first_month_this_year_ts = mktime(0, 0, 0, date("F", strtotime('first month of this year')) + 1, date('d'), date('Y')); // timestamp
$today = date("j F Y", strtotime('today')); // human date
$today_ts = strtotime('today'); // timestamp
$today_day_of_year = date("z", $today_ts);// int
@jasonkiss
jasonkiss / override_mce_options.php
Last active May 12, 2016 09:17
Remove empty <p> from WordPress content. Prevent TinyMCE in Wordpress from wrapping non-block elements or text nodes in <p> tags or injecting empty paragraphs. Fixes the problem where moving from the textual to the visual editor causes unwanted <p>&nbsp;</p> to be added. See https://www.tinymce.com/docs/configure/content-filtering/#forced_root_b…
<?php
function override_mce_options($in) {
$in['forced_root_block'] = false;
return $in;
}
add_filter('tiny_mce_before_init', 'override_mce_options');
?>
@JamesMessinger
JamesMessinger / README.md
Last active April 19, 2026 23:23
VSCode GitHub Markdown Theme

GitHub Markdown Theme for Visual Studio Code

This CSS stylesheet allows you to preview markdown files in VSCode using GitHub's mardown theme. This CSS was taken directly from the official GitHub Markdown repo. I replaced their top-level .markdown-body class with the body tag so it would work in VSCode, and added styling for the html tag to match GitHub's fixed-width container.

Instructions

  1. Copy the CSS file to your computer
    Copy the github-markdown.css file below to your computer. You can put it anywhere you want, but I chose to put it in the same folder as my VSCode settings file.

  2. Edit your VSCode settings
    If you want to use this theme for all of your projects, then edit your User Settings file. If you just want to use this them

@kbrnsr
kbrnsr / dropbox
Last active December 30, 2016 23:08
Retooled dropbox init file to work with dropbox systemd systemunit file. Should be in /bin as /bin/dropbox with permission 755, see my unit file here: https://gist.github.com/kbrnsr/3984a0b45dcce5430d01
#!/bin/sh
# To configure, add line with DROPBOX_USERS="user1 user2" to /etc/sysconfig/dropbox
# Probably should use a dropbox group in /etc/groups instead.
# Source function library.
. /etc/rc.d/init.d/functions
prog=dropboxd
lockfile=${LOCKFILE-/var/lock/subsys/$prog}
@kbrnsr
kbrnsr / dropbox.service
Last active January 9, 2022 15:24
Systemd unit file for dropbox, works with CentOS 7, should be in /etc/systemd/system/ as /etc/systemd/system/dropbox.service and permission 755, for the script fiile for starting and stopping dropbox see me gist here: https://gist.github.com/kbrnsr/571f0bdb865e8fb1d846
[Unit]
Description=Dropbox is a filesyncing sevice provided by dropbox.com. This service starts up the dropbox daemon.
After=network.target syslog.target
[Service]
Environment=LC_ALL=en_US.UTF-8
Environment=LANG=en_US.UTF-8
EnvironmentFile=-/etc/sysconfig/dropbox
ExecStart=/bin/dropbox start
ExecReload=/bin/dropbox restart
@julianxhokaxhiu
julianxhokaxhiu / pagespeed_optimize_images.sh
Last active March 23, 2026 14:51
Recursively optimize all PNG and JPG files wherever they are from the script position and inner ( based on OPTING, PNGCRUSH, ADVANCECOMP and JPEGOPTIM )
#!/bin/bash
# Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
find . -type f -iname "*.png" -exec optipng -nb -nc {} \;
find . -type f -iname "*.png" -exec advpng -z4 {} \;
find . -type f -iname "*.png" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec jpegoptim -f --strip-all {} \;
@IanHopkinson
IanHopkinson / lxml_examples.py
Created November 24, 2015 19:42
Examples of xpath queries using lxml in python
#!/usr/bin/env python
# encoding: utf-8
import lxml.etree
import lxml.html
import requests
xml_sample = """<?xml version="1.0" encoding="UTF-8"?>
<foo:Results xmlns:foo="http://www.foo.com" xmlns="http://www.bah.com">
<foo:Recordset setCount="2">
@xrstf
xrstf / letsencrypt.md
Last active February 11, 2026 10:15
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@tristanisfeld
tristanisfeld / browsersync.js
Last active November 7, 2025 05:32
Gulp 4 - Multifile tasks w/ external config. Basic gulpfile template for use with multiple task files, using gulp-load-plugins
// =========================================================
// Gulp Task: browsersync
// NOTE: Using gulp v4
// Description: Sync sass, typescript, html, and browser
// using external config or add modify src
// npm install --save-dev browser-sync gulp-typescript gulpjs/gulp.git#4.0 gulp-load-plugins
// Options: node-sass gulp-sass || gulp-ruby-sass
// =========================================================
var config = require('../config.js');
var browserSync = require('browser-sync').create();
@v0lkan
v0lkan / nginx.conf
Last active May 1, 2026 02:49
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx