Skip to content

Instantly share code, notes, and snippets.

View davegallant's full-sized avatar
☃️

Dave Gallant davegallant

☃️
View GitHub Profile
@ladinu
ladinu / encryptedNixos.md
Last active January 2, 2025 15:06
NixOS install with encrypted /boot /root with single password unlock

Requirements

  1. Encrypt everthing including /boot and /root
  2. Enter password once
  3. Support UEFI

Installation media setup

Download NixOS minimal iso and copy to USB stick. For example on Mac OSX

$ diskutil list
$ diskutil unmountDisk /dev/disk1 # Make sure you got right device
@RobertoPrevato
RobertoPrevato / aioshot.py
Last active March 11, 2022 15:19
Useful scripts
"""
aiohttp shooting
"""
import os
import asyncio
import aiohttp
import time
url = "https://example/isalive"
@magnetikonline
magnetikonline / README.md
Last active January 12, 2025 22:31
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script which will:

  • Iterate all commits made within a Git repository.
@ivanleoncz
ivanleoncz / flask_app_logging.py
Last active February 26, 2025 21:14
Demonstration of logging feature for a Flask App.
#/usr/bin/python3
""" Demonstration of logging feature for a Flask App. """
from logging.handlers import RotatingFileHandler
from flask import Flask, request, jsonify
from time import strftime
__author__ = "@ivanleoncz"
import logging
@peterhurford
peterhurford / pytest-fixture-modularization.md
Created July 28, 2016 15:48
How to modularize your py.test fixtures

Using py.test is great and the support for test fixtures is pretty awesome. However, in order to share your fixtures across your entire module, py.test suggests you define all your fixtures within one single conftest.py file. This is impractical if you have a large quantity of fixtures -- for better organization and readibility, you would much rather define your fixtures across multiple, well-named files. But how do you do that? ...No one on the internet seemed to know.

Turns out, however, you can define fixtures in individual files like this:

tests/fixtures/add.py

import pytest

@pytest.fixture
@ursuad
ursuad / kafka-cheat-sheet.md
Last active March 12, 2025 10:08
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# [email protected]
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@martijnvermaat
martijnvermaat / nixos.md
Last active February 16, 2025 00:09
Installation of NixOS with encrypted root
@jayarampradhan
jayarampradhan / Dockerfile
Last active February 23, 2023 04:27
MongoDB Docker Container (Centos 7, Mongo DB 3.x)
# Dockerizing MongoDB: 3.1 Dockerfile for building MongoDB 3.1 images
# Based on centos:centos7, installs MongoDB
FROM centos:centos7
MAINTAINER Jayaram Pradhan <[email protected]>
# Set up mongodb yum repo entry
# https://www.liquidweb.com/kb/how-to-install-mongodb-on-centos-6/
RUN echo -e "\
@feelinc
feelinc / UploadDirS3.py
Last active October 8, 2024 20:55
Upload folder contents to AWS S3
#!/usr/bin/python
import os
import sys
import boto3
# get an access token, local (from) directory, and S3 (to) directory
# from the command-line
local_directory, bucket, destination = sys.argv[1:4]