Skip to content

Instantly share code, notes, and snippets.

@salrashid123
salrashid123 / main.py
Last active April 4, 2022 17:28
GCP Log Consolidation with Flask
https://google-cloud-python.readthedocs.io/en/latest/logging/usage.html
https://google-cloud-python.readthedocs.io/en/latest/logging/usage.html#integration-with-python-logging-module
https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry
NOTE: as of 9/7/18
https://github.com/GoogleCloudPlatform/google-cloud-python/pull/5878
https://github.com/GoogleCloudPlatform/google-cloud-python/pull/5885
@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@istepanov
istepanov / Makefile
Created November 11, 2017 00:44
Makefile for deploying Python 3 AWS Lambda
PROJECT = myProject
FUNCTION = $(PROJECT)
REGION = us-west-1
ENVCHAIN = my-aws-env
all: build
.PHONY: clean build deploy
clean:
@checco
checco / rw_ro_access.sql
Last active March 22, 2024 08:32 — forked from oinopion/read-access.sql
How to create a read only user in AWS RDS PostgreSQL and a user with superuser privileges on AWS RDS PostgreSQL
--
-- Read only
--
-- Create a group
CREATE ROLE postgres_ro_group;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO postgres_ro_group;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO postgres_ro_group;
@kyokley
kyokley / bandit_hook.md
Last active June 28, 2018 06:33
Checking for Python Security Vulnerabilities with VIM

Checking for Python Security Vulnerabilities with VIM (Buffer Pre-write Hook Part 3)

Introduction

To continue my series of vim pre-write hooks, I wanted to add a new check for security static analysis failures. To see the progression of the series, please check out my other gists.

Back to security... In my office, we use OpenStack's Bandit static analysis tool. If you're not familiar with it, you should check it out. It's pretty nifty.

Getting Started

@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@meub
meub / gist:cc4fe3e0d4269efb8569c7ce70a2addd
Last active April 12, 2024 19:38
Scrape ReserveAmerica for Available Campsites
import os, sys, re, io, json, time
import mechanize
import pytz
import smtplib
import bs4
from datetime import datetime, timedelta
from pytz import timezone
from bs4 import BeautifulSoup
from email.mime.text import MIMEText
@sosedoff
sosedoff / 1_simple.go
Created July 16, 2016 18:45
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
import speech_recognition
import pyttsx
speech_engine = pyttsx.init('sapi5') # see http://pyttsx.readthedocs.org/en/latest/engine.html#pyttsx.init
speech_engine.setProperty('rate', 150)
def speak(text):
speech_engine.say(text)
speech_engine.runAndWait()
@gbaman
gbaman / HowToOTG.md
Last active May 16, 2024 20:10
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int