Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
That worked!

Dominik dommmel

💭
That worked!
View GitHub Profile
View iops-hetzner-ceph-volumnes.txt
# cd /root && fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75
test: (g=0): rw=randrw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
fio-3.16
Starting 1 process
test: Laying out IO file (1 file / 4096MiB)
Jobs: 1 (f=1): [m(1)][100.0%][r=15.6MiB/s,w=5433KiB/s][r=4004,w=1358 IOPS][eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=11569: Tue Feb 16 14:09:52 2021
read: IOPS=4001, BW=15.6MiB/s (16.4MB/s)(3070MiB/196382msec)
bw ( KiB/s): min=15568, max=19176, per=100.00%, avg=16006.79, stdev=170.15, samples=392
iops : min= 3892, max= 4794, avg=4001.70, stdev=42.53, samples=392
View spree-schema-selection.rb
create_table "spree_option_types", force: :cascade do |t|
t.string "name", limit: 100
t.string "presentation", limit: 100
t.integer "position", default: 0, null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["name"], name: "index_spree_option_types_on_name"
t.index ["position"], name: "index_spree_option_types_on_position"
end
View update_sendy.sh
#!/usr/bin/env bash
# Enter your license key below
license_key=XXXXXXXXXXXXXXXXX
curl -O -J -L 'https://sendy.co/download/?license=${license_key}'
filename=$(basename -- sendy-*.zip)
newdir="${filename%.*}"
echo ${newdir}
View SketchSystems.spec
Image Modifier
Specify Preview Image*
Empty URL*
typed -> Filled URL
Filled URL
submitted -> Select Ad Format
Select Ad Format
selected Single -> Single
selected Carousel -> Carousel
Carousel*
@dommmel
dommmel / blob_authenticatable.rb
Last active May 14, 2022
Devise authentication for Rails' ActiveStorage
View blob_authenticatable.rb
# Rails controller concern to enable Devise authentication for ActiveStorage.
# Put it in +app/controllers/concerns/blob_authenticatable.rb+ and include it when overriding
# +ActiveStorage::BlobsController+ and +ActiveStorage::RepresentationsController+.
#
# Optional configuration:
#
# Set the model that includes devise's database_authenticatable.
# Defaults to Devise.default_scope which defaults to the first
# devise role declared in your routes (usually :user)
#
@dommmel
dommmel / mamp_function
Last active Mar 24, 2018 — forked from jonathanstark/mamp_function
Serve the current directory with MAMP from the command line
View mamp_function
function mamp() {
#
# Default location of the apache conf file for MAMP
CONF_FILE="/Applications/MAMP/conf/apache/httpd.conf"
#
# Fish existing doc root out of conf file
LINE=$(cat $CONF_FILE | grep "^DocumentRoot")
QUOTED_STRING=${LINE/DocumentRoot /}
OLD_DOC_ROOT=${QUOTED_STRING//\"/}
#
@dommmel
dommmel / hide_payment-gateway_unless_customer_has_tag.rb
Last active Dec 12, 2017
Shopify Script to enable payment gateway only for customer with a certain tag
View hide_payment-gateway_unless_customer_has_tag.rb
PAYMENT_GATEWAY_NAME = 'Invoice'
CUSTOMER_TAG = 'VIP'
customer = Input.cart.customer
remove_gateway = (customer.nil? or !customer.tags.include?(CUSTOMER_TAG))
if remove_gateway
Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway|
payment_gateway.name == PAYMENT_GATEWAY_NAME
end
@dommmel
dommmel / invite_to_slack.js
Created May 25, 2016
Zapier Code to auto invite users to slack
View invite_to_slack.js
var slackTeam = "YOUR_SLACK_TEAM_NAME ";
var token = 'YOUR_ADMIN_TEST_TOKEN';
// A test token will suffice.
// You can generate one at https://api.slack.com/docs/oauth-test-tokens
// Just make sure that the user issuing the test token is an admin.
var url = 'https://'+ slackTeam + '.slack.com/api/users.admin.invite';
fetch(url, {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
@dommmel
dommmel / i18n.js
Last active Sep 17, 2015
i18n for static-handlebars-brunch via handlebars-helper-i18n
View i18n.js
/*
put this file in your app folder and add the following to yout brunch config.coffee
exports.config =
plugins:
staticHandlebars:
includeFile: 'app/translations.js'
# Usage examples:
# {{i18n "key"}}
# {{i18n "key" language="fr"}}