Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Daniel Sturm dsturm

🏠
Working from home
View GitHub Profile
@dsturm
dsturm / DKIM_SPF_Sendmail
Created Mar 11, 2019 — forked from artmouse/DKIM_SPF_Sendmail
DKIM + SPF + Sendmail for multiple domains (Ubuntu)
View DKIM_SPF_Sendmail
DKIM is DomainKeys Identified Mail and is used in mail servers, such as Postfix or Sendmail to sign e-mails and thus authenticating the sender so that a forgery can be detected. It also reduces the possibility of an e-mail being flagged as spam, but it's not a definite prevention.
A much simpler method is using SPF (Sender Policy Framework) which, in a nutshell, verifies the sender IP address.
According to the internet, using both should result to ????, PROFIT !!!.
SPF does not need a specific configuration. Whitelisted servers are listed in a DNS record, TXT or SPF, and an example record is:
example.com. IN TXT "v=spf1 a mx ~all"
View tastillery.css
.template-page-club .section-header.club-page-header {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
padding: 50px 55px;
}
.template-page-club .section-header-grid-item {
@dsturm
dsturm / index.html
Created Nov 20, 2017
Vue Datetime Picker Component // source http://jsbin.com/yurexon
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vue Datetime Picker Component</title>
<link rel="stylesheet" type="text/css" href="http://cdn.jsdelivr.net/bootstrap/3/css/bootstrap.css"/>
<link rel="stylesheet" type="text/css" href="http://cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css"/>
<style type="text/css">
body {
margin: 5em;
@dsturm
dsturm / target_blank.js
Last active Oct 26, 2017 — forked from allybee/target_blank.js
Add target="_blank" to external links with pure JavaScript.
View target_blank.js
function targetBlank() {
// remove subdomain of current site's url and setup regex
var internal = location.host.replace(/^[^.]+\./g, '');
internal = new RegExp(internal, "i");
var a = document.getElementsByTagName('a'); // then, grab every link on the page
for (var i = 0; i < a.length; i++) {
var href = a[i].host; // set the host of each link
if (!internal.test(href)) {
// make sure the href doesn't contain current site's host
@dsturm
dsturm / countdown_expr.js
Last active May 4, 2017
Adobe AfterEffects
View countdown_expr.js
/**
* Expression for displaying up- or countdowns
* @credits to https://forums.adobe.com/thread/2191716
*/
rate = 1;
direction = 'down';
type = 'full';
clockStart = 0;
@dsturm
dsturm / _leastSquaresFit.scss
Created Apr 28, 2017 — forked from Jakobud/_leastSquaresFit.scss
Least Squares Fit Linear Regression SASS function
View _leastSquaresFit.scss
/// leastSquaresFit
/// Calculate the least square fit linear regression of provided values
/// @param {map} $map - A SASS map of viewport width and size value combinations
/// @return Linear equation as a calc() function
/// @example
/// font-size: leastSquaresFit((576: 24, 768: 24, 992: 34));
/// @author Jake Wilson <jake.e.wilson@gmail.com>
@function leastSquaresFit($map) {
// Get the number of provided breakpoints
@dsturm
dsturm / auth_token.php
Last active Apr 26, 2017
Create Auth Tokens with PHP
View auth_token.php
function create_auth_token($length = 64)
{
if (!$length || intval($length) <= 8) {
$length = 64;
}
$bytes = null;
if (function_exists('random_bytes')) {
$bytes = random_bytes($length);
} elseif (function_exists('mcrypt_create_iv')) {
$bytes = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
View gist:2593244cd889618ef304ea7e674344b3
$param_value = isset( $$param['param_name'] ) ? $$param['param_name'] : '';
$param_value = isset(${$param['param_name']}) ? ${$param['param_name']} : '';
View fix_backspace.md

bindkey "^?" backward-delete-char

@dsturm
dsturm / fix-wordpress-permissions.sh
Last active Mar 20, 2021 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions (for bedrock)
View fix-wordpress-permissions.sh
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_ROOT=$1 # <-- wordpress root directory
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group