Skip to content

Instantly share code, notes, and snippets.

apiVersion: v1
kind: ConfigMap
metadata:
name: custom-headers
namespace: ingress-nginx
data:
X-geoip-area-code: $geoip_area_code
X-geoip-city-continent-code: $geoip_city_continent_code
X-geoip-city-country-code: $geoip_city_country_code
X-geoip-city-country-code3: $geoip_city_country_code3
@Braunson
Braunson / pivot-tables.md
Last active August 13, 2023 19:25
Laravel 8.x - Diving into Pivot Tables

Laravel 6 - Diving Into Pivot Tables

Pivot tables can be confusing and a little hard to wrap your head around at first. In this quick article we are going to dive into what a pivot table is, how to create one and finally how to use the pivot table. Let's dive in!

What is a pivot table?

A pivot table is used to connect relationships between two tables. Laravel provides a Many To Many relationship where you can use a pivot table.

@jacoor
jacoor / header.py
Created September 17, 2018 16:20
skipping header in AWS glue
# use filter, Luke
# the idea is to use a filter function that will return True for the records to keep.
# Usage: just use before the last function at end of your ETL job script. Update frame and update next function frame with "filtered".
def filter_function(dynamicRecord):
if dynamicRecord.merchant_id == "merchant_id" and dynamicRecord.merchant_ref_number == "merchant_ref_number":
return False
else:
return True
filtered = Filter.apply(frame = dropnullfields3, f = filter_function, transformation_ctx = "filtered")
@cameroncowden
cameroncowden / page.google-product-feed.liquid
Created August 15, 2018 15:34
Shopify Google Product Feed xml generator
{% comment %}
Instructions:
- Create a blank page called 'Google Base Product Feed'and save it
- Open that page for editing and select 'page.google-feed' from the page template selector
- Add a brief site description to the meta-shop-description snippet
- The feed url should now be available at http://www.yoursite.com/pages/google-base-product-feed
- validate your field at http://validator.w3.org/feed/
- when ready, submit your feed at http://base.google.com
@hassy
hassy / kms-vault
Last active December 29, 2023 04:11
Encrypt/decrypt files using AWS KMS
#!/usr/bin/env bash
# License: MIT - https://opensource.org/licenses/MIT
#
# Usage:
#
# Encrypt a file:
# kms-vault encrypt My-Key-Alias some-file-i-want-encrypted.txt > topsecret.asc
#
@lobster1234
lobster1234 / localstack.md
Last active August 8, 2023 20:06
Working with localstack on command line

Starting localstack

C02STG51GTFM:localstack mpandit$ make infra
. .venv/bin/activate; exec localstack/mock/infra.py
Starting local dev environment. CTRL-C to quit.
Starting local Elasticsearch (port 4571)...
Starting mock ES service (port 4578)...
Starting mock S3 server (port 4572)...
Starting mock SNS server (port 4575)...
@petitviolet
petitviolet / MainThreadCallback.java
Last active May 13, 2023 12:15
OkHttp Callback on Main Thread.
public abstract class MainThreadCallback implements Callback {
private static final String TAG = MainThreadCallback.class.getSimpleName();
abstract public void onFail(final Exception error);
abstract public void onSuccess(final String responseBody);
@Override
public void onFailure(final Request request, final IOException e) {
@MikeNGarrett
MikeNGarrett / siege
Last active April 3, 2024 03:49
Siege with JSON POST data
# Changed to use content-type flag instead of header: -H 'Content-Type: application/json'
siege -c50 -t60S --content-type "application/json" 'http://domain.com/path/to/json.php POST {"ids": ["1","2","3"]}'
@gunjanpatel
gunjanpatel / amazon-ec2-ftp.md
Last active October 10, 2023 15:31
amazon ec2 LAMP and FTP installation and setup
@leesmith
leesmith / simple-git-workflow.md
Last active December 30, 2023 23:37
Simple Git Workflow For Continuous Delivery

Simple Git Workflow For Continuous Delivery

Workflow guidelines:

  • master branch is always production-ready, deployable, 100% green test suite
  • New development is done on feature branches, with frequent rebasing onto master
  • Clean commit history by preferring to rebase instead of merge (git pull is configured to automatically rebase)

rebase workflow

Workflow