Skip to content

Instantly share code, notes, and snippets.

View ambrose40's full-sized avatar
💾
Coding

Boriss Melikjan ambrose40

💾
Coding
View GitHub Profile
@ambrose40
ambrose40 / chrome-color-profile-hint
Created February 29, 2024 13:18
Make Google Chrome look nicer and with cleaner, brighter, color rich pics
chrome://flags/#force-color-profile
Change it to sRGB.
@ambrose40
ambrose40 / .gitconfig
Created February 28, 2024 13:35
Batch push commits - partial push
[alias]
partial-push = "!sh -c 'REMOTE=$0;BRANCH=$1;BATCH_SIZE=2; if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then range=$REMOTE/$BRANCH..HEAD; else range=HEAD; fi; n=$(git log --first-parent --format=format:x $range | wc -l); echo "Have to push $n packages in range of $range"; for i in $(seq $n -$BATCH_SIZE 1); do h=$(git log --first-parent --reverse --format=format:%H --skip $i -n1); echo "Pushing $h..."; git push $REMOTE ${h}:refs/heads/$BRANCH; done; git push $REMOTE HEAD:refs/heads/$BRANCH'"
@ambrose40
ambrose40 / revert-order-of-lines.py
Created February 28, 2024 13:27
Revert order of lines for text file
def reverse_file_lines(input_file_path, output_file_path):
with open(input_file_path, 'r') as reader:
lines = reader.readlines()
with open(output_file_path, 'w') as writer:
for line in reversed(lines):
writer.write(line)
input_file_path = 'input.txt' # The file to be reversed
output_file_path = 'output.txt' # The file to write the reversed content to
@ambrose40
ambrose40 / commit-batch.py
Created February 28, 2024 13:25
Batch create git commit history from scratch, using max commit size
import os
import subprocess
# Set the maximum allowed size in MB
MAX_COMMIT_SIZE = 200
def get_files_and_sizes(directory):
files_and_sizes = []
for root, _, files in os.walk(directory):
for f in files:
@ambrose40
ambrose40 / CREDITS.md
Created August 18, 2020 16:32 — forked from byrro/CREDITS.md
AWS Step Functions Example - Data Migration

CREDITS

This code snippet was extracted from an AWS Step Functions example.

It can ben found in the AWS Console for the Step Functions service.

Follow the instructions on this documentation page

Date: 2019-10-16

@ambrose40
ambrose40 / mymodule.php
Created July 31, 2020 12:14 — forked from prestarocket/mymodule.php
prestashop cron method
/* Run cron tasks */
public function hookActionCronJob()
{
return $this->cronTask();
}
/* Return cron job execution frequency */
public function getCronFrequency()
{
return array(
'hour' => -1,