Skip to content

Instantly share code, notes, and snippets.

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

Exploit.cz insekticid

🏠
Working from home
View GitHub Profile
@denniswebb
denniswebb / aws_cli_install.tf
Last active September 1, 2023 16:47
Terraform module to install aws cli for Terraform Enterprise (Atlas)
data "template_file" "main" {
template = <<EOF
set -e
WORKDIR=/tmp/${uuid()}
mkdir -p "$WORKDIR"
cd "$WORKDIR"
curl -f "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
./awscli-bundle/install -i "$WORKDIR"/aws
@sandcastle
sandcastle / redirect-ingress.yml
Created August 27, 2017 02:07
An example of a ingress redirect using kubernetes and nginx `configuration-snippet`
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: redirect-ingress
annotations:
ingress.kubernetes.io/configuration-snippet: |
if ($host ~ ^(.+)\.somedomain\.io$) {
return 301 https://$1.domain.io$request_uri;
}
spec:
@ryzy
ryzy / haproxy.cfg
Created March 13, 2016 00:20
HAProxy conf with SSL termination and HTTP/2 support
global
#debug
chroot /var/lib/haproxy
user haproxy
group haproxy
pidfile /var/run/haproxy.pid
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
// change your piwik server host
// change YOUR_SITE_ID with your site id
<amp-pixel src="https://piwik.example.org/piwik.php?idsite=YOUR_SITE_ID&rec=1&action_name=TITLE&urlref=DOCUMENT_REFERRER&url=CANONICAL_URL&rand=RANDOM"></amp-pixel>
@mjpowersjr
mjpowersjr / gist:740a9583e9ec8b49e0a3
Last active May 2, 2024 01:26
Parsing the MySQL slow query log via Logstash (the easy way?)

The MySQL slow query log is a difficult format to extract information from. After looking at various examples with mixed results, I realized that it's much easier to configure MySQL to write the slow query log to a table in CSV format!

From the MySQL documentation:

By default, the log tables use the CSV storage engine that writes data in comma-separated values format. For users who have access to the .CSV files that contain log table data, the files are easy to import into other programs such as spreadsheets that can process CSV input.

my.cnf

Note: don't forget to open up permissions on your slow query log CSV file so logstash can read it!

# enable slow query log
@raucao
raucao / nginx-lua-s3.nginxconf
Last active September 8, 2020 01:29
Nginx proxy to S3
location ~* ^/s3/(.*) {
set $bucket '<REPLACE WITH YOUR S3 BUCKET NAME>';
set $aws_access '<REPLACE WITH YOUR AWS ACCESS KEY>';
set $aws_secret '<REPLACE WITH YOUR AWS SECRET KEY>';
set $url_full "$1";
set_by_lua $now "return ngx.cookie_time(ngx.time())";
set $string_to_sign "$request_method\n\n\n\nx-amz-date:${now}\n/$bucket/$url_full";
set_hmac_sha1 $aws_signature $aws_secret $string_to_sign;
set_encode_base64 $aws_signature $aws_signature;

Includes:

  • Configuration
  • BrowserSync
  • Environments (e.g.,: --environment=production)
  • Image optimization (gif, jpg, png, and svg)
  • Sass compilation with external libraries
  • Bower installed Sass libraries example(s)
  • CSS processing with Pleeease
@ruzickap
ruzickap / openwrt_system.sh
Created April 13, 2014 17:04
OpenWrt system and firewall changes
#Configure ssh key autologin:
ssh-copy-id -i ~/.ssh/id_rsa root@192.168.1.1
uci set system.@system[0].hostname=gate
uci add_list sshd.@openssh[0].Port=2222
uci add firewall rule
uci set firewall.@rule[-1].name=ssh
uci set firewall.@rule[-1].src=wan
uci set firewall.@rule[-1].target=ACCEPT
@ruzickap
ruzickap / openwrt_fstab.sh
Last active May 17, 2022 09:43
OpenWrt fstab - create and mount external USB stick
mkdir /data
mkfs.ext4 -L data /dev/mmcblk0p1
uci add fstab mount
uci set fstab.@mount[-1].device=/dev/mmcblk0p1
uci set fstab.@mount[-1].target=/data
uci set fstab.@mount[-1].fstype=ext4
uci set fstab.@mount[-1].options=rw,sync,noatime,nodiratime
uci set fstab.@mount[-1].enabled=1