Skip to content

Instantly share code, notes, and snippets.

@sblask
sblask / ls
Created November 19, 2013 13:46
ls with list, human readable sizes, hidden files and sorting
ls -lhac
From: http://web.archive.org/web/20160904174444/http://andreafrancia.it/2010/03/understanding-the-output-of-rsync-itemize-changes.html
As you may know the rsync's --delete options if misused could make severe damage.
To prevent this you can use the --itemize-change and the --dry-run options to figure out how the command will behave before launching the real one.
The output will be something like that:
.d..t..g... ./
.f...p.g... Something.pdf
@sblask
sblask / setup_show_diagnostics.lua
Created October 20, 2022 03:16
Run this in on_attach to show diagnostics in a floating window
local setup_show_diagnostics = function(buffer)
local opts = {
border = 'rounded',
close_events = {
'BufLeave',
'CursorMoved',
'DiagnosticChanged',
'FocusLost',
'InsertEnter',
},
This file has been truncated, but you can view the full file.
2022-04-06T16:59:30.743+1200 [INFO] Terraform version: 1.1.7
2022-04-06T16:59:30.743+1200 [INFO] Go runtime version: go1.17.2
2022-04-06T16:59:30.743+1200 [INFO] CLI args: []string{"terraform", "plan", "-out", "plan", "-target", "module.cloudfront.module.logging_lambda.aws_lambda_function.lambda"}
2022-04-06T16:59:30.743+1200 [DEBUG] Attempting to open CLI config file: /Users/sebastian/.terraformrc
2022-04-06T16:59:30.743+1200 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022-04-06T16:59:30.744+1200 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2022-04-06T16:59:30.744+1200 [DEBUG] ignoring non-existing provider search directory /Users/sebastian/.terraform.d/plugins
2022-04-06T16:59:30.744+1200 [DEBUG] ignoring non-existing provider search directory /Users/sebastian/Library/Application Support/io.terraform/plugins
2022-04-06T16:59:30.744+1200 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2022-04-06T16:59:
@sblask
sblask / gist:5c1140a3e00e9fa6555cc92a924cdd32
Created July 21, 2021 00:25
terraform debug output 210721 1225
$ TF_LOG=trace terp
2021-07-21T12:23:42.996+1200 [DEBUG] Adding temp file log sink: /var/folders/qy/wfckskrd51l41bfk_ddbx9f40000gn/T/terraform-log219492604
2021-07-21T12:23:42.996+1200 [INFO] Terraform version: 1.0.2
2021-07-21T12:23:42.996+1200 [INFO] Go runtime version: go1.16.4
2021-07-21T12:23:42.996+1200 [INFO] CLI args: []string{"/Users/sebastian/.bin/terraform", "plan", "-out", "plan"}
2021-07-21T12:23:42.996+1200 [TRACE] Stdout is a terminal of width 362
2021-07-21T12:23:42.996+1200 [TRACE] Stderr is a terminal of width 362
2021-07-21T12:23:42.996+1200 [TRACE] Stdin is a terminal
2021-07-21T12:23:42.996+1200 [DEBUG] Attempting to open CLI config file: /Users/sebastian/.terraformrc
2021-07-21T12:23:42.996+1200 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
@sblask
sblask / .pylintrc
Created November 4, 2013 13:59
PyLint configuration file, initially generated with `pylint --generate-rcfile ` and then edited. See http://docs.pylint.org/features.html for disabled messages
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Profiled execution.
~/Clones/sandpit $ TF_LOG=TRACE terraform_0_15_0 plan -out plan
2021-04-15T21:45:35.458+1200 [DEBUG] Adding temp file log sink: /var/folders/qy/wfckskrd51l41bfk_ddbx9f40000gn/T/terraform-log231794640
2021-04-15T21:45:35.458+1200 [INFO] Terraform version: 0.15.0
2021-04-15T21:45:35.458+1200 [INFO] Go runtime version: go1.16.2
2021-04-15T21:45:35.458+1200 [INFO] CLI args: []string{"/Users/sebastian/.bin/terraform_0_15_0", "plan", "-out", "plan"}
2021-04-15T21:45:35.458+1200 [TRACE] Stdout is a terminal of width 275
2021-04-15T21:45:35.458+1200 [TRACE] Stderr is a terminal of width 275
2021-04-15T21:45:35.458+1200 [TRACE] Stdin is a terminal
2021-04-15T21:45:35.458+1200 [DEBUG] Attempting to open CLI config file: /Users/sebastian/.terraformrc
2021-04-15T21:45:35.458+1200 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
~/Clones/sandpit $ TF_LOG=TRACE terraform_0_15_0 plan -out plan
2021-04-15T20:18:05.888+1200 [DEBUG] Adding temp file log sink: /var/folders/qy/wfckskrd51l41bfk_ddbx9f40000gn/T/terraform-log369535931
2021-04-15T20:18:05.888+1200 [INFO] Terraform version: 0.15.0
2021-04-15T20:18:05.888+1200 [INFO] Go runtime version: go1.16.2
2021-04-15T20:18:05.888+1200 [INFO] CLI args: []string{"/Users/sebastian/.bin/terraform_0_15_0", "plan", "-out", "plan"}
2021-04-15T20:18:05.889+1200 [TRACE] Stdout is a terminal of width 137
2021-04-15T20:18:05.889+1200 [TRACE] Stderr is a terminal of width 137
2021-04-15T20:18:05.889+1200 [TRACE] Stdin is a terminal
2021-04-15T20:18:05.889+1200 [DEBUG] Attempting to open CLI config file: /Users/sebastian/.terraformrc
2021-04-15T20:18:05.889+1200 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
@sblask
sblask / logging_configuration.py
Last active August 31, 2019 14:52
Python logging configuration
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)5s - %(name)s - %(message)s',
filename=os.path.join(os.path.sep, 'path'),
)
def get_log_handler():
log_format = '%(asctime)s - %(levelname)5s - %(name)s - %(message)s'
log_filename = os.path.join(os.path.sep, 'path')
log_formatter = logging.Formatter(log_format)
import json
import socket
import ssl
ssl_socket = ssl.wrap_socket(socket.socket(), cert_reqs=ssl.CERT_REQUIRED, ca_certs='/etc/ssl/certs/ca-certificates.crt')
ssl_socket.connect(('google.com', 443))
print json.dumps(ssl_socket.getpeercert(), indent=4)