Skip to content

Instantly share code, notes, and snippets.

judbd

Block or report user

Report or block judbd

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
@joachimesque
joachimesque / config.php
Created Jan 4, 2018
CSP headers with a script-src nonce directive for Kirby
View config.php
<?php
/*
---------------------------------------
CSP
---------------------------------------
*/
$csp_nonce = base64_encode(random_bytes(20));
$csp_header = "Content-Security-Policy: default-src 'self'; script-src 'self' 'nonce-" . $csp_nonce . "';";
// set `csp-nonce` so it's accessable
@enwin
enwin / WSL_and_frond-end.md
Last active Sep 12, 2018
(WIP) Windows / WSL configuration to get a nice front-end setup
View WSL_and_frond-end.md
@ivomynttinen
ivomynttinen / srcset.php
Last active Feb 7, 2017
Kirby CMS Tag for srcset images. Supports the attributes "retina" (file name of the @2x resource), "alt" (alt text on img), "class" (additional class on the img element). Place under /site/tags/
View srcset.php
<?php
kirbytext::$tags['srcset'] = array(
'attr' => array(
'retina',
'alt',
'class'
),
'html' => function($tag) {
View new-methods.php
<!-- create the complete html img tag for a given image -->
<?= $page->image()->html() ?>
<!-- modify the attributes of the img tag -->
<?= $page->image()->html(['class' => 'myImage']) ?>
<!-- resize an image first and then get the img tag for it -->
<?= $page->image()->resize(300,200)->html() ?>
View gist:122907e95956602e5c09
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@lekkerduidelijk
lekkerduidelijk / .htaccess
Created Oct 8, 2014
Kirby CMS htaccess file - SEO optimized - 1000+ spam related IP blocks
View .htaccess
# pass the default character set
AddDefaultCharset utf-8
php_flag short_open_tag on
ErrorDocument 404 /error
# Kirby .htaccess
# exclude panel from trailing slash removal
@bastianallgeier
bastianallgeier / statify.php
Last active Aug 5, 2018
A first draft for a script, which converts a Kirby site into a static site. It's a rough first draft, so don't expect it to be perfect. Play with it, if you like it!
View statify.php
<?php
/**
* Instructions:
*
* 1. Put this into the document root of your Kirby site
* 2. Make sure to setup the base url for your site correctly
* 3. Run this script with `php statify.php` or open it in your browser
* 4. Upload all files and folders from static to your server
* 5. Test your site
View adblock.sh
#!/bin/sh
#Put in /etc/adblock.sh
#Script to grab and sort a list of adservers and malware
#Check proper DHCP config and, if necessary, update it
uci get dhcp.@dnsmasq[0].addnhosts > /dev/null 2>&1 || uci add_list dhcp.@dnsmasq[0].addnhosts=/etc/block.hosts && uci commit
#Leave crontab alone, or add to it
grep -q "/etc/adblock.sh" /etc/crontabs/root || echo "0 4 * * 0,3 sh /etc/adblock.sh" >> /etc/crontabs/root
@teffalump
teffalump / README.md
Last active Aug 26, 2019
OpenWRT adblock implementation
View README.md

Others have recently developed packages for this same functionality, and done it better than anything I could do. Use the packages instead of this script:

Description

In its basic usage, this script will modify the router such that blocked addresses are null routed and unreachable. Since the address blocklist is full of advertising, malware, and tracking servers, this setup is generally a good thing. In addition, the router will update the blocklist weekly. However, the blocking is leaky, so do not expect everything to be blocked.

@cowboy
cowboy / #bf4-emblem-import-export.md
Last active Aug 14, 2018
JavaScript: BF4 Battlelog Emblem Import / Export
View #bf4-emblem-import-export.md

Exporting an emblem

  1. Log into BF4 Battlelog.
  2. Visit the Customize emblem page.
  3. Select the emblem you wish to export.
  4. Open the console (Ctrl-Shift-J).
  5. Enter the following code snippet to copy the raw emblem data to the clipboard:
    copy('emblem.emblem.load('+JSON.stringify(emblem.emblem.data,null,2)+');');
  6. Paste somewhere useful, like a gist. Whatever.
  7. Close the console (Ctrl-Shift-J).
You can’t perform that action at this time.