Skip to content

Instantly share code, notes, and snippets.

View nevergone's full-sized avatar

Kurucz István nevergone

View GitHub Profile
@davereid
davereid / gist:954384
Created May 3, 2011 22:18
Drupal 7: Entity and bundle select fields with AJAX dependent dropdown
<?php
function entity_bundle_ajax_form() {
$form['entity_type'] = array(
'#type' => 'select',
'#title' => t('Entity type'),
'#options' => array('' => t('- Select one - ')),
'#default_value' => '',
'#ajax' => array(
'callback' => 'entity_bundle_ajax_form_callback',
@nrk
nrk / command.txt
Created April 2, 2012 19:19
Using ffprobe to get info from a file in a nice JSON format
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"
#!/usr/bin/env bash
# Usage: {script} DIRECTORY
# Find PHP's commented code and remove then.
#
# --help, -h Displays this help
#
# Report bugs to Henrique Moody <henriquemoody@gmail.com>
#
declare -r SCRIPT_NAME=$(basename ${0})
#!/usr/bin/env bash
DEBIAN_PACKAGES="
apache2 \
curl \
default-jre-headless \
git \
python-pip
python-typogrify \
unzip \
@jmwhittaker
jmwhittaker / gist:8516514
Last active May 2, 2024 03:16
Use FFmpeg to resize and generate .mp4 & .webm videos from any source video.
/**
Scaling
- Scale can be used as is which will set the height to 560 but keep aspect ratio for width.
- Other options include setting both with & height
- Watch out for sizing errors when not divisible by 2
**/
/** MP4 1st pass **/
ffmpeg -i input.mov -vcodec libx264 -vprofile high -preset veryslow -b:v 225k -maxrate 300k -bufsize 1000k -vf scale=-1:560 -threads 2 -pass 1 -an -f mp4 /dev/null
@didip
didip / docker-builder.sh
Last active May 7, 2022 19:42
Small helper script that automates Docker building and pushing
#!/bin/bash
set -ex
PARENT_DIR=$(basename "${PWD%/*}")
CURRENT_DIR="${PWD##*/}"
IMAGE_NAME="$PARENT_DIR/$CURRENT_DIR"
TAG="${1}"
REGISTRY="hub.docker.com"
SELECT
id, name
FROM
names
order by
FIELD(
(
CASE 1
WHEN SUBSTRING(BINARY name 1, 3) = 'Dzs'
THEN 'Dzs'
@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/)
@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:
@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