Skip to content

Instantly share code, notes, and snippets.

@warriordog
warriordog / #Snapd Managment Scripts.md
Last active April 25, 2024 16:55
Snapd Management Scripts

Snapd Management Scripts

This gist contains some simple scripts that enable control over Snap's automatic updates.

Scripts

  • disable-snap.sh - Disables the snap service and blocks updates.
  • enable-snap.sh - Enables the snap service and allows updates and managing the snap package database.
  • update-snap.sh - Temporarily enables snap and updates all packages. Disables snap when finished.
  • install.sh - Installs all scripts as global commands.

Setup (blocking automatic Snap updates)

@y0lopix
y0lopix / windows-tweaks.reg
Last active April 25, 2024 16:54
Useful tweaks for Windows 11 and Windows 10
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search]
"BingSearchEnabled"=dword:00000000
"AllowSearchToUseLocation"=dword:00000000
"CortanaConsent"=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search]
"AllowCortana"=dword:00000000
"DisableWebSearch"=dword:00000001
@scottgreenup
scottgreenup / .eslintrc.js
Created October 10, 2017 00:15
.eslintrc.js example
module.exports = {
'extends': 'google',
'parserOptions': {
'ecmaVersion': 6,
},
'rules': {
// https://eslint.org/docs/rules/array-bracket-spacing
'array-bracket-spacing': ['error', 'never'],
@nymous
nymous / README.md
Last active April 25, 2024 16:50
Logging setup for FastAPI, Uvicorn and Structlog (with Datadog integration)

Logging setup for FastAPI

This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.

Then, you can use Structlog loggers or standard logging loggers, and they both will be processed by the Structlog pipeline (see the hello() endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!

Requests are assigned a correlation ID with the asgi-correlation-id middleware (either captured from incoming request or generated on the fly). All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented. This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog. You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom

@krzemienski
krzemienski / logging_subprocess.py
Created February 24, 2020 18:47 — forked from jaketame/logging_subprocess.py
Python subprocess logging to logger from stdout/stderr
#!/usr/local/bin/python3
import logging, select, subprocess
LOG_FILE = "test.log"
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO,filename=LOG_FILE,format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
def logging_call(popenargs, **kwargs):
process = subprocess.Popen(popenargs, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
@Klerith
Klerith / cloudbuild.yml
Last active April 25, 2024 16:49
Google Cloud - Build steps
steps:
- name: "gcr.io/cloud-builders/docker"
args:
[
"build",
"-t",
"XXXXX-docker.pkg.dev/project-name/registry/image-name",
"-f",
"dockerfile.prod",
"--platform=linux/amd64",
@carcinocron
carcinocron / debugger pause beforeunload
Last active April 25, 2024 16:48
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
#
# Sample configuration file for the CUPS scheduler. See "man cupsd.conf" for a
# complete description of this file.
#
# Log general information in error_log - change "warn" to "debug"
# for troubleshooting...
LogLevel warn
# Deactivate CUPS' internal logrotating, as we provide a better one, especially
@tomas-stefano
tomas-stefano / Capybara.md
Last active April 25, 2024 16:44
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", "6.0.0"