Skip to content

Instantly share code, notes, and snippets.

View gadelkareem's full-sized avatar
🎯
Focusing

Gadelkareem gadelkareem

🎯
Focusing
View GitHub Profile
@PieterScheffers
PieterScheffers / start_docker_registry.bash
Last active October 29, 2023 18:26
Start docker registry with letsencrypt certificates (Linux Ubuntu)
#!/usr/bin/env bash
# install docker
# https://docs.docker.com/engine/installation/linux/ubuntulinux/
# install docker-compose
# https://docs.docker.com/compose/install/
# install letsencrypt
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
@cupracer
cupracer / varnishlog-examples.sh
Last active February 27, 2024 11:11
varnishlog examples (version 4.x)
# filter by request host header
varnishlog -q 'ReqHeader ~ "Host: example.com"'
# filter by request url
varnishlog -q 'ReqURL ~ "^/some/path/"'
# filter by client ip (behind reverse proxy)
varnishlog -q 'ReqHeader ~ "X-Real-IP: .*123.123.123.123"'
# filter by request host header and show request url and referrer header
@mcarrowd
mcarrowd / main.go
Last active January 1, 2024 21:58
golang win1251 <-> utf8 encoding issue demonstration
package main
import (
"fmt"
"golang.org/x/text/encoding/charmap"
)
func main() {
for i := 0; i <= 255; i++ {
charnum := uint8(i)
sub vcl_hit {
if (obj.ttl >= 0s) {
# normal hit
return (deliver);
}
# We have no fresh fish. Lets look at the stale ones.
if (std.healthy(req.backend_hint)) {
# Backend is healthy. Limit age to 10s.
if (obj.ttl + 10s > 0s) {
set req.http.grace = "normal(limited)";
1. No way of reusing task output in main play.
2. Cannot specify multiple fail_when statements.
3. [*] A play is atomic, i.e. I can't take the output from a command, parse its json then act on it. I need to create an intermediary fact containing the json dict then use that in another play. It's tedious.
4. If you're missing a variable in a variable file, Ansible won't fail to parse it. It will just tell you "VARIABLE IS NOT DEFINED!," which is ambiguous
5. Doing anything "complicated" (like looping within a loop for deeply nested Ansible variables) is right out.
6. selectattr doesn't actually do what you think it does!
7. Missing vars within tasks or roles can lead to very very VERY cryptic errors
8. So you can't set booleans with set_facts without casting......... https://github.com/ansible/ansible/issues/5463
9. It would be great if I could say something like:
@enoch85
enoch85 / lussh
Last active May 27, 2023 18:09 — forked from sbleon/lussh
lussh - script to authorize your SSH key on a server
#!/bin/bash
# make sure to run this with /bin/bash, NOT /bin/sh
echo
echo This script will help you setup ssh public key authentication.
host=dummy
@PowerKiKi
PowerKiKi / generate-wildcard-certificate.sh
Created December 4, 2015 07:31
Generate self-signed wildcard SSL certificate for development environment
#!/usr/bin/env bash
# print usage
DOMAIN=$1
if [ -z "$1" ]; then
echo "USAGE: $0 domain.lan"
echo ""
echo "This will generate a non-secure self-signed wildcard certificate for given domain."
echo "This should only be used in a development environment."
@blindpet
blindpet / purgevarnishsingle
Last active May 20, 2023 09:51
clear one url home page varnish cache
Enter varnish admin
varnishadm
clear cache for index home page only
ban req.http.host ~ www.htpcguides.com && req.url ~ "^/$"
clear cache for specific page
@potter0815
potter0815 / cloneall.sh
Last active January 30, 2024 13:07
clone all private repos of an organization
#!/bin/bash
#requires jq -> http://stedolan.github.io/jq/
#optional change working_dir
working_dir=${1-$(pwd)}
cd $working_dir
user="github_username"
token="application token"
organization="Organization_Name"
@wolfhechel
wolfhechel / Vagrantfile
Created March 14, 2015 13:23
nftables router
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = '2'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.