Skip to content

Instantly share code, notes, and snippets.

@dsummersl
dsummersl / sigv4_using_http_client.py
Created July 18, 2024 16:05 — forked from marcogrcr/sigv4_using_http_client.py
Send request with SigV4 in python using boto3
from boto3.session import Session
from botocore.auth import SigV4Auth
from botocore.awsrequest import AWSRequest
from botocore.credentials import Credentials
from http.client import HTTPConnection, HTTPSConnection
import json
import os
from urllib.parse import urlparse
def sigv4_request(
@dsummersl
dsummersl / .profile fragment
Created December 5, 2012 15:43 — forked from jcamenisch/.profile fragment
Lightning-fast project-wide find/replace with git grep and sed -- with confirm option.
gg_replace() {
if [[ "$#" == "0" ]]; then
echo 'Usage:'
echo ' gg_replace term replacement file_mask'
echo ' gg_replace [-c] term replacement file_mask'
echo
echo 'Options:'
echo ' -c == confirm. Allows you to interactively confirm each modification.'
echo
echo 'Example:'
@dsummersl
dsummersl / .profile fragment
Created December 5, 2012 15:43 — forked from jcamenisch/.profile fragment
Lightning-fast project-wide find/replace with git grep and sed
gg_replace() {
if [[ "$#" == "0" ]]; then
echo 'Usage:'
echo ' gg_replace term replacement file_mask'
echo
echo 'Example:'
echo ' gg_replace cappuchino cappuccino *.html'
echo
else
find=$1; shift
@dsummersl
dsummersl / .profile fragment
Created December 5, 2012 15:42 — forked from christilden/.profile fragment
Lightning-fast project-wide find/replace with git grep and sed
gg_replace() {
if [[ "$#" == "0" ]]; then
echo 'Usage:'
echo ' gg_replace term replacement file_mask'
echo
echo 'Example:'
echo ' gg_replace cappuchino cappuccino *.html'
echo
else
find=$1; shift
@dsummersl
dsummersl / gist:4041911
Created November 8, 2012 21:49 — forked from miceno/gist:802781
Groovy (java) escape HTML with grapes
import org.apache.commons.lang.StringEscapeUtils
// Import with groovy grapes:
@Grab(group='commons-lang', module='commons-lang', version='2.3' )
xml = '''
<module id="id" version="0.0.1" package="package"> </module>
'''
StringEscapeUtils.escapeHtml(xml).split("\n").each() {println it }