Skip to content

Instantly share code, notes, and snippets.

View davegallant's full-sized avatar
🐧
coding

Dave Gallant davegallant

🐧
coding
View GitHub Profile
@feelinc
feelinc / UploadDirS3.py
Last active June 5, 2024 08:14
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]
@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 <jayaram.pradhan@uimirror.com>
# Set up mongodb yum repo entry
# https://www.liquidweb.com/kb/how-to-install-mongodb-on-centos-6/
RUN echo -e "\
@oznu
oznu / README.md
Last active June 9, 2024 16:57
How to Bootcamp / Dual Boot Windows 10 on a mid-2011 iMac using USB

How to Install / Bootcamp Windows 10 on a mid-2011 iMac using USB

Apple has released support for bootcamping Windows 10, but only on 2012 Macs and later. Despite not being supported. it is possible to install Windows 10 on earlier iMacs and it seems to run quite well.

IMPORTANT: Unplug all external and physical hard drives (where possible) that you won't be installing to to avoid accidentally erasing them. Also make note of which drives and partitions remain (e.g. System and Storage hard drives), and be super careful to not erase the wrong one.

RECOVERY: If you nuke your machine, restore your time machine backup. Instructions here.

Requirements

@martijnvermaat
martijnvermaat / nixos.md
Last active May 9, 2024 01:11
Installation of NixOS with encrypted root
@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)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@ursuad
ursuad / kafka-cheat-sheet.md
Last active March 14, 2024 10:32
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 ...

@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
@ivanleoncz
ivanleoncz / flask_app_logging.py
Last active May 23, 2021 07:25
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
@magnetikonline
magnetikonline / README.md
Last active June 17, 2024 22:36
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script to:

  • Iterate all commits made within a Git repository.
@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"