Skip to content

Instantly share code, notes, and snippets.

View schneidr's full-sized avatar
🏠
Working from home

Gerald Schneider schneidr

🏠
Working from home
View GitHub Profile
@schneidr
schneidr / python-init.sh
Last active August 20, 2024 08:49
Shell script to quickly initialize a python flask application
#!/usr/bin/env bash
set -e
if [ $# -eq 0 ]; then
>&2 echo "No arguments provided"
>&2 echo "Usage: $0 <projectname>"
exit 1
fi
PROJECT_NAME="$1"
@schneidr
schneidr / Dockerfile
Last active November 7, 2022 10:18
Compile environment for extended Hugo for CentOS 7
FROM centos:7
RUN yum install gcc gcc-c++ make unzip wget -y && \
wget https://go.dev/dl/go1.19.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go*.linux-amd64.tar.gz && \
rm go*.linux-amd64.tar.gz
ADD compile_hugo.sh /usr/local/bin/compile_hugo.sh
WORKDIR /work
ENTRYPOINT /usr/local/bin/compile_hugo.sh
@schneidr
schneidr / diff-hosts.sh
Last active December 2, 2021 08:28
Shows differences between two hosts. Very helpful with diagnosing why something works on one host, but not on the other.
#!/bin/bash
if [ $# -lt 3 ]; then
echo "not enough arguments"
echo "usage: $0 <host> <host> <module|modules|all>"
exit 1
fi
COLUMNS=$(tput cols)
HOSTA="$1"
@schneidr
schneidr / github_forks_branches.ps1
Created September 14, 2021 06:54
List all branches of forks from a GitHub repository that don't exist on the root repository
param(
[Parameter(Mandatory=$true)]
[string]$rootRepo
)
$gh = 'C:\Program Files (x86)\GitHub CLI\gh.exe'
$rootBranches = (. $gh api /repos/$rootRepo/branches | ConvertFrom-Json).name
$repos = . $gh api /repos/$rootRepo/forks | ConvertFrom-Json
$repos | ForEach-Object {
$repo = $_.full_name
$branches = (. $gh api /repos/$repo/branches | ConvertFrom-Json).name
@schneidr
schneidr / ansible-sudo.sh
Last active May 20, 2019 10:26
sudo-esque password caching behaviour for ansible vault
#!/bin/bash
# sudo-esque password caching behaviour for ansible vault
#
# WARNING! the password will be stored in a clear text file until 5 minutes after you used the script last
#
# Place this script as ansible-sudo.sh in your path
# Set the following settings:
# crontab -e
# * * * * * find ~/.ansible/ -name password_tmp -mmin +5 -delete
# .bashrc
@schneidr
schneidr / .htaccess
Last active January 22, 2018 17:38
Secure a development site in a .htaccess or directly in the Apache config. Allows access with a known token as a parameter.
RewriteEngine On
# Allow access when the GET parameter t=let_me_in is set and set a cookie
<If "%{QUERY_STRING} =~ /t=let_me_in$/">
RewriteRule ^(.*)$ "/?t=authorized" [R,CO=ALLOWED:YES:dev.example.com]
</If>
# Allow access when the cookie is set
<ElseIf "%{HTTP_COOKIE} =~ /ALLOWED/">
RewriteRule ^(.*)$ "-" [CO=ALLOWED:YES:dev.example.com]
</ElseIf>
# Reject everybody else

Nearly every line in your code is just nonsense.

somthing.com?udid=(me1,456)&&udid=(me2,457)

This will not work. You are using the same variable name twice, overwriting the first so only the second will be available in your PHP. If you want to use multiple variables you have to give every one a name or use an array:

somthing.com?udid[]=(me1,456)&&udid[]=(me2,457)

But this won't help you much, you have to split everything again. It will be easier if you call your script like this: