Skip to content

Instantly share code, notes, and snippets.

View S1SYPHOS's full-sized avatar
🐧
hackin' on Linux

Martin Folkers S1SYPHOS

🐧
hackin' on Linux
View GitHub Profile
@S1SYPHOS
S1SYPHOS / jekyll-and-liquid.md
Created May 3, 2017 09:08 — forked from magicznyleszek/jekyll-and-liquid.md
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@S1SYPHOS
S1SYPHOS / config.php
Last active February 16, 2018 23:24 — forked from joachimesque/config.php
CSP headers with a script-src nonce directive for Kirby
<?php
/*
---------------------------------------
HTTP Security headers
---------------------------------------
*/
// Generating CSP nonce & defining CSP header
$csp_nonce = base64_encode(random_bytes(20));
@S1SYPHOS
S1SYPHOS / gem_reset.sh
Created January 22, 2018 18:29
This script removes all ruby gems except default ones.
#!/usr/bin/env ruby
`gem list -d`.split(/\n\n^(?=\w)/).each do |data|
match = data.match(/(?<name>([^\s]+)) \((?<versions>.*)\)/)
name = match[:name]
versions = match[:versions].split(', ')
if match = data.match(/^.*\(([\d\.]*),? ?default\): .*$/)
next if match[1].empty? # it's the only version if this match is empty
versions.delete(match[1] || versions[0])
@S1SYPHOS
S1SYPHOS / submodules_update.sh
Created January 22, 2018 18:34
These one-liners update all Git submodules at once.
# Older Git versions
git submodule foreach 'git fetch origin --tags; git checkout master; git pull' && git pull && git submodule update --init --recursive
# Newer Git versions
git submodule update --remote --merge
@S1SYPHOS
S1SYPHOS / yarn.sh
Created February 12, 2018 20:12
Installing yarn locally w/o sudo
#!/bin/bash
# https://hackernoon.com/how-to-use-yarn-in-a-project-without-installing-yarn-f946815ddb4e
# Choose which version of yarn you want to use
EXPECTED_YARN_VERSION="0.16.1"
function install_yarn {
mkdir -p .yarn
DOWNLOAD_URL="https://github.com/yarnpkg/yarn/releases/download/v$EXPECTED_YARN_VERSION/yarn-v$EXPECTED_YARN_VERSION.tar.gz"
echo "Downloading from $DOWNLOAD_URL"
@S1SYPHOS
S1SYPHOS / svg-url.scss
Created February 17, 2018 23:54
SASS function to create an inline SVG url() source.
/*
* Replacing SVG strings in data-uri style situations
* by Jakob Erikson -- https://github.com/jakob-e
*
* http://codepen.io/jakob-e/pen/doMoML
*/
// Function to replace characters in a string
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
<?php
// CSV files > CSV file
function mergeCSV(array $input = [], string $output = '')
{
$count = 0;
foreach (glob($input) as $file) {
if (($handle = fopen($file, 'r')) !== false) {
@S1SYPHOS
S1SYPHOS / generate_issue.php
Last active April 20, 2019 23:22
Example script for Fundevogel's recommended novelties, turning CSV & SLA files into optimized PDFs (see https://github.com/Fundevogel/recommended-novelties)
<?php
require_once('vendor/autoload.php');
$currentIssue = '2019_01';
function generateIssue($issue)
{
$src = './src/' . $issue;
@S1SYPHOS
S1SYPHOS / dirmngr.conf
Created June 17, 2019 17:10
Modern GnuPG Configuration
##################
# DIRMNGR CONF #
##################
##
# SKS keyserver running as Tor hidden service
# See https://sks-keyservers.net/overview-of-pools.php#pool_tor
keyserver hkp://jirk5u4osbsr34t5.onion
##