Skip to content

Instantly share code, notes, and snippets.

View nevergone's full-sized avatar

Kurucz István nevergone

View GitHub Profile
@icetee
icetee / permissions.sh
Created September 12, 2018 16:27 — forked from heyalexej/permissions.sh
Fix WordPress File Permission
#!/bin/bash -ex
#
# configures wordpress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# script is aware of .git directories by default. edit if you need to consider
# other folders as well.
#
# you will find a log file in /tmp/ in case you fucked up.
@dantleech
dantleech / README.md
Last active October 21, 2021 21:22
PHPStan Drupal Integration
$ composer require phpstan/phpstan

Drupal dynamically adds to the class autoloader at runtime, so it is necessary to bootstrap Drupal in order that it is fully populated. Note that this may require that the database be accessible (i.e. may be problematic when working with Docker). This is why we use a custom autoload file below.

$ ./bin/phpstan analyse --level=7 -c phpstan.neon docroot/modules/custom
@bdlangton
bdlangton / Blocks.md
Last active October 12, 2023 08:40
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@chx
chx / services-grep
Last active September 11, 2017 18:21
services-grep
ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' $2 | \
jq -Mr --arg name "$1" '.services | keys[] as $k | .[$k] | select(.tags[]?.name == $name) | $k'
# ag -l -G '.services.yml$' access_check| while read filename ;do services-grep access_check "$filename" ;done
@calebporzio
calebporzio / composer_versions_cheatsheet.md
Last active June 6, 2023 17:40
Composer version symbol cheatsheet
...
"require": {
    "vendor/package": "1.3.2", // exactly 1.3.2 (exact)

    // >, <, >=, <= | specify upper / lower bounds
    "vendor/package": ">=1.3.2", // anything above or equal to 1.3.2
    "vendor/package": "<1.3.2", // anything below 1.3.2

 // * | wildcard
@juampynr
juampynr / db-download.sh
Last active September 24, 2018 21:27
Downloads a Drupal database dump from a Docker container
#!/usr/bin/env bash
# Downloads a database dump from a docker container
#
# Usage:
# sh db-download.sh [hostname] [user] [container]
set -x
HOST=$1
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active June 10, 2024 11:53
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@chx
chx / discussion_aliases.yml
Last active June 4, 2016 21:42
How to migrate node/user/etc aliases
id: discussion_aliases
label: Discussion aliases
source:
plugin: d7_node
node_type: discussion
constants:
english: en
node: /node
empty: ""
process:
@milankragujevic
milankragujevic / drupal_passChange.php
Last active September 5, 2021 13:49
Exploiting Drupal 7's SQL Injection vulnerability to change the admin user's password. http://milankragujevic.com/post/66
<?php
/********************************************************
* Drupal 7 SQL Injection vulnerability demo
* Created by Milan Kragujevic (of milankragujevic.com)
* Read more at http://milankragujevic.com/post/66
* This will change the first user's username to admin
* and their password to admin
* Change $url to the website URL
********************************************************/
$url = '[URL HERE]'; // URL of the website (http://domain.com/)
SELECT
id, name
FROM
names
order by
FIELD(
(
CASE 1
WHEN SUBSTRING(BINARY name 1, 3) = 'Dzs'
THEN 'Dzs'