Skip to content

Instantly share code, notes, and snippets.

View rgpublic's full-sized avatar

rgpublic

  • Düsseldorf, Germany, EU 🇩🇪 🇪🇺
  • 15:26 (UTC +01:00)
View GitHub Profile
@rgpublic
rgpublic / compile.js
Created November 4, 2024 13:41
LightningCSS Compile
#!/usr/bin/env node
import lightningcss from '/usr/lib/node_modules/lightningcss/node/index.js';
import fs from 'fs/promises';
import * as path from 'path';
const {transform} = lightningcss;
if (process.argv.length!=4) {
console.log('Usage: compile.js <inputfile> <outputfile>');
process.exit(1);
@rgpublic
rgpublic / hooks.php
Created October 11, 2022 13:25
Add salutation field to billing address in Drupal Commerce
<?php
function hook_commerce_inline_form_customer_profile_alter(&$inline_form,FormStateInterface $form_state,array &$complete_form) {
$inline_form['#after_build'][]='after_build';
}
function after_build(&$form) {
$address=&$form['address']['widget'][0]['address'];
$address['field_salutation']=$form['field_salutation'];
$address['field_salutation']['#weight']=-3;
@rgpublic
rgpublic / drupal-fix-base-field.sh
Last active December 11, 2020 11:02
Drupal fix UID basefield
#!/bin/bash
list=`drush ev 'echo implode("\n", Drupal::service("config.factory")->listAll("core.base_field_override."))' | \
grep -Po "([^\.]+\.[^\.]+)(?=\.uid$)"`
changed=false
while IFS= read -r item; do
parts=(${item//./ })
<?php
class SerializableClosure {
private $args;
private $code;
function __construct($args,$code) {
$this->args=$args;
$this->code=$code;
#!/bin/bash
SERVER="matrix.mycompany.com"
echo -e "\e[97mEnter user you'd like to deactivate\e[0m";
read user
if [ "$user" == "" ]; then
echo "User required.";
exit;
@rgpublic
rgpublic / gist:1a721599332402f55625afc3886b967a
Created December 14, 2018 18:52
pdf2svg static build docker file
# Install necessary packages
RUN apt-get install -y bsdtar
RUN apt-get install -y cmake
RUN apt-get install -y libfreetype6-dev
RUN apt-get install -y libfontconfig-dev
RUN apt-get install -y libjpeg-dev
RUN apt-get install -y libcairo-dev
RUN apt-get install -y libopenjp2-7-dev
RUN apt-get install -y libffi-dev
RUN apt-get install -y libtiff-dev
#!/bin/bash
echo -e "\e[97mPlease enter password for Synapse/Matrix root user:\e[0m";
read -s password
echo -e "\e[97mEnter user you'd like to deactivate\e[0m";
read user
url_user=`echo -n "$user" | jq -s -R -r @uri`
json=`curl -s --insecure -XPOST -d '{"type":"m.login.password", "user":"root", "password":"'$password'"}' "https://localhost:8448/_matrix/client/r0/login"`
access_token=`echo "$json" | jq -r ".access_token"`
#!/bin/bash
## CAUTION:
## This script will remove (hopefully) all trace of the given room ID from
## your homeserver.db
## Do not run it lightly.
set -e