Skip to content

Instantly share code, notes, and snippets.

@kekru
kekru / git-copy-files-to-empty-branch.md
Last active February 26, 2024 05:51
git: Copy files to new branch without history, using a squash merge

Git: New branch with files but no history

This is how to copy your files from a given git branch to a new empty branch, using a squash merge.
This example will copy files from branch old-branch to target-branch

# First be sure, that you don't have uncommitted working changes. They will be deleted

# Checkout a new empty branch without history
git checkout --orphan target-branch
@nguyenkims
nguyenkims / log.py
Last active February 13, 2024 07:59
Basic example on how setup a Python logger
import logging
import sys
from logging.handlers import TimedRotatingFileHandler
FORMATTER = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
LOG_FILE = "my_app.log"
def get_console_handler():
console_handler = logging.StreamHandler(sys.stdout)
console_handler.setFormatter(FORMATTER)
@leonardofed
leonardofed / README.md
Last active March 28, 2024 17:32
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@mdogo
mdogo / fibonacci_itertools.md
Last active October 22, 2022 12:10
Itertools examples with Fibonacci Sequence

By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two. The recursive definition of the fibonacci number in Python is:

def fiboncci(n):
    if n == 0:
      return 0
    elif n == 1:
      return 1
 else
@octopy
octopy / s3_multipart_upload.py
Created December 27, 2013 10:39
Example of Parallelized Multipart upload using boto
#!/usr/bin/env python
"""Split large file into multiple pieces for upload to S3.
S3 only supports 5Gb files for uploading directly, so for larger CloudBioLinux
box images we need to use boto's multipart file support.
This parallelizes the task over available cores using multiprocessing.
Usage:
s3_multipart_upload.py <file_to_transfer> <bucket_name> [<s3_key_name>]
@delicb
delicb / main.py
Last active December 15, 2023 21:42
Python logging configuration example with multiple modules.
import logging
from logging.config import dictConfig
# adding custom level
logging.VERBOSE = 5
logging._levelNames.update({
5: 'VERBOSE',
'VERBOSE': 5,
})
Name Department Manager Salary
Robin Hood 200
Arsene Wenger Bar Friar Tuck 50
Friar Tuck Foo Robin Hood 100
Little John Foo Robin Hood 100
Sam Allardyce 250
Dimi Berbatov Foo Little John 50