Skip to content

Commit

Permalink
feat: customized rework
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixWaweru committed Jun 23, 2023
1 parent a4c21bf commit 2beedf9
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 227 deletions.
203 changes: 29 additions & 174 deletions gitfiti.py → DOOM.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# released under The MIT license (MIT) http://opensource.org/licenses/MIT
#
"""
gitfiti
DOOM
noun : Carefully crafted graffiti in a GitHub commit history calendar
"""
Expand All @@ -31,157 +31,26 @@


GITHUB_BASE_URL = 'https://github.com/'
FALLBACK_IMAGE = 'kitty'
FALLBACK_IMAGE = 'mask'


TITLE = '''
_ __ _____ __ _
____ _(_) /_/ __(_) /_(_)
/ __ `/ / __/ /_/ / __/ /
/ /_/ / / /_/ __/ / /_/ /
\__, /_/\__/_/ /_/\__/_/
/____/
______ _____ _____ ___ ___
| _ \| _ || _ || \/ |
| | | || | | || | | || . . |
| | | || | | || | | || |\/| |
| |/ / \ \_/ /\ \_/ /| | | |
|___/ \___/ \___/ \_| |_/
'''


KITTY = [
[0,0,0,4,0,0,0,0,4,0,0,0],
[0,0,4,2,4,4,4,4,2,4,0,0],
[0,0,4,2,2,2,2,2,2,4,0,0],
[2,2,4,2,4,2,2,4,2,4,2,2],
[0,0,4,2,2,3,3,2,2,4,0,0],
[2,2,4,2,2,2,2,2,2,4,2,2],
[0,0,0,3,4,4,4,4,3,0,0,0],
]

ONEUP = [
[0,4,4,4,4,4,4,4,0],
[4,3,2,2,1,2,2,3,4],
[4,2,2,1,1,1,2,2,4],
[4,3,4,4,4,4,4,3,4],
[4,4,1,4,1,4,1,4,4],
[0,4,1,1,1,1,1,4,0],
[0,0,4,4,4,4,4,0,0],
]

ONEUP2 = [
[0,0,4,4,4,4,4,4,4,0,0],
[0,4,2,2,1,1,1,2,2,4,0],
[4,3,2,2,1,1,1,2,2,3,4],
[4,3,3,4,4,4,4,4,3,3,4],
[0,4,4,1,4,1,4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INY = [
[0,4,4,0,4,4,0],
[4,2,0,4,2,2,4],
[4,0,2,2,2,2,4],
[4,2,2,2,2,2,4],
[0,4,2,2,2,4,0],
[0,0,4,2,4,0,0],
[0,0,0,4,0,0,0],
MASK = [
[0,0,1,1,1,0,0],
[0,1,1,3,1,1,0],
[1,2,2,1,2,2,1],
[1,0,0,2,0,0,1],
[1,1,1,2,1,1,1],
[1,1,0,0,0,1,1],
[0,1,0,0,0,1,0]
]

ASCII_TO_NUMBER = {
Expand Down Expand Up @@ -224,21 +93,7 @@ def is_empty_line(line):


IMAGES = {
'kitty': KITTY,
'oneup': ONEUP,
'oneup2': ONEUP2,
'hackerschool': HACKERSCHOOL,
'octocat': OCTOCAT,
'octocat2': OCTOCAT2,
'hello': HELLO,
'heart1': HEART1,
'heart2': HEART2,
'hireme': HIREME,
'oneup_str': ONEUP_STR,
'beer': BEER,
'gliders': GLIDERS,
'heart' : HEART,
'heart_shiny' : HEART_SHINY,
'mask' : MASK,
}

SHELLS = {
Expand Down Expand Up @@ -356,12 +211,12 @@ def generate_values_in_date_order(image, multiplier=1):
def commit(commitdate, shell):
template_bash = (
'''GIT_AUTHOR_DATE={0} GIT_COMMITTER_DATE={1} '''
'''git commit --allow-empty -m "gitfiti" > /dev/null\n'''
'''git commit --allow-empty -m "DOOM" > /dev/null\n'''
)

template_powershell = (
'''$Env:GIT_AUTHOR_DATE="{0}"\n$Env:GIT_COMMITTER_DATE="{1}"\n'''
'''git commit --allow-empty -m "gitfiti" | Out-Null\n'''
'''git commit --allow-empty -m "DOOM" | Out-Null\n'''
)

template = template_bash if shell == 'bash' else template_powershell
Expand All @@ -377,8 +232,8 @@ def fake_it(image, start_date, username, repo, git_url, shell, offset=0, multipl
'cd $REPO\n'
'touch README.md\n'
'git add README.md\n'
'touch gitfiti\n'
'git add gitfiti\n'
'touch DOOM\n'
'git add DOOM\n'
'{1}\n'
'git branch -M main\n'
'git remote add origin {2}:{3}/$REPO.git\n'
Expand All @@ -393,8 +248,8 @@ def fake_it(image, start_date, username, repo, git_url, shell, offset=0, multipl
'cd $REPO\n'
'New-Item README.md -ItemType file | Out-Null\n'
'git add README.md\n'
'New-Item gitfiti -ItemType file | Out-Null\n'
'git add gitfiti\n'
'New-Item DOOM -ItemType file | Out-Null\n'
'git add DOOM\n'
'{1}\n'
'git branch -M main\n'
'git remote add origin {2}:{3}/$REPO.git\n'
Expand Down Expand Up @@ -442,34 +297,34 @@ def main():
m = calculate_multiplier(max_daily_commits)

repo = request_user_input(
'Enter the name of the repository to use by gitfiti: ')
'Enter the name of the repository to use by DOOM: ')

offset = request_user_input(
'Enter the number of weeks to offset the image (from the left): ')

offset = int(offset) if offset.strip() else 0

print((
'By default gitfiti.py matches the darkest pixel to the highest\n'
'By default DOOM.py matches the darkest pixel to the highest\n'
'number of commits found in your GitHub commit/activity calendar,\n'
'\n'
'Currently this is: {0} commits\n'
'\n'
'Enter the word "gitfiti" to exceed your max\n'
'Enter the word "DOOM" to exceed your max\n'
'(this option generates WAY more commits)\n'
'Any other input will cause the default matching behavior'
).format(max_daily_commits))
match = request_user_input()

match = m if (match == 'gitfiti') else 1
match = m if (match == 'DOOM') else 1

print('Enter file(s) to load images from (blank if not applicable)')
img_names = request_user_input().split(' ')

loaded_images = load_images(img_names)
images = dict(IMAGES, **loaded_images)

print('Enter the image name to gitfiti')
print('Enter the image name to DOOM')
print('Images: ' + ', '.join(images.keys()))
image = request_user_input()

Expand Down Expand Up @@ -499,7 +354,7 @@ def main():
output = fake_it(image, start_date, username, repo, git_url, shell, offset,
fake_it_multiplier)

output_filename = 'gitfiti.{}'.format(SHELLS[shell])
output_filename = 'DOOM.{}'.format(SHELLS[shell])
save(output, output_filename)
print('{} saved.'.format(output_filename))
print('Create a new(!) repo named {0} at {1} and run the script'.format(repo, git_base))
Expand Down
58 changes: 7 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
[![Build Status](https://travis-ci.org/gelstudios/gitfiti.svg?branch=master)](https://travis-ci.org/gelstudios/gitfiti)
# DOOMfiti

**gitfiti** _noun_ : Carefully crafted graffiti in a github commit history calendar.

An example of gitfiti in the wild:
![screenshot of gitfiti](https://raw.github.com/gelstudios/gitfiti/master/gitfiti-screenshot.png "screenshot")

`gitfiti.py` is a tool to decorate your github account's commit history calendar by (blatantly) abusing git's ability to accept commits _in the past_.

How? `gitfiti.py` generates a script (powershell or bash) that makes commits with the GIT_AUTHOR_DATE and GIT_COMMITTER_DATE environment variables set for each targeted pixel.

Since this is likely to clobber repo's history, it is highly recommend that you create a _new_ github repo when using gitfiti. Also, the generated script assumes you are using public-key authentication with git.

### Pixel Art

![pixel art examples](https://raw.github.com/gelstudios/gitfiti/master/pixels-large.png "pixel art")
Included "art" from left to right: kitty, oneup, oneup2, hackerschool, octocat, octocat2
Make your commits MF DOOM themed.

### Usage

1. Create a new github repo to store your handiwork.
2. Run `gitfiti.py` and follow the prompts for username, art selection, offset, and repo name.
3. Run the generated `gitfiti.sh` or `gitfiti.ps1` from your home directory (or any non-git tracked dir) and watch it go to work.
4. Wait... Seriously, you'll probably need to wait a day or two for the gitfiti to show in your commit graph.
2. Run `DOOM.py` and follow the prompts for username, art selection, offset, and repo name.
3. Run the generated `DOOMfiti.sh` or `DOOMfiti.ps1` from your home directory (or any non-git tracked dir) and watch it go to work.
4. Wait... Seriously, you'll probably need to wait a day or two for the DOOMfiti to show in your commit graph.

### User Templates

Expand Down Expand Up @@ -51,38 +37,8 @@ Once you have a file with templates, enter its name when prompted and the templa

### Removal

Fortunately if you regret your gitfiti in the morning, removing it is fairly easy: delete the repo you created for your gitfiti (and wait).
Fortunately if you regret your DOOMfiti in the morning, removing it is fairly easy: delete the repo you created for your DOOMfiti (and wait).

### License

gitfiti is released under [The MIT license (MIT)](http://opensource.org/licenses/MIT)

---

#### Todo

- ~~Remove 'requests' dependency~~ [_thanks empathetic-alligator_](https://github.com/empathetic-alligator)
- ~~Web interface~~ See several web-based things below
- ~~Load "art" from a file~~ [_thanks empathetic-alligator_](https://github.com/empathetic-alligator)
- Load commit content from a file
- Text/alphabet option
- ~~powershell support!~~ [_thanks axzn_](https://github.com/axzn)
- ...
- Profit?

#### Notable derivatives or mentions

- [Vincent Van Git](https://github.com/jh3y/vincent-van-git) Vincent, which offers a [very slick web ui](https://vincent-van-git.netlify.app/) to generate a gitfiti script
- [github-calendar-customerizer](https://github.com/ZachSaucier/github-calendar-customizer) from ZachSaucier, another very [nice web GUI](https://codepen.io/ZachSaucier/full/PzVRBy) for generating gitfiti templates
- [git-art](https://github.com/jamesjarvis/git-art) from jamesjarvis, a work-alike web based [editor GUI](https://jamesjarvis.github.io/git-art/) that generates the script too
- [Pikesley's](https://github.com/pikesley) Pokrovsky, which offers Github History Vandalism [as a Service!](http://pokrovsky.herokuapp.com/)
- [PSVandalism](https://github.com/DenisBalan/PSVandalism) Wrapper around Pokrovsky, which makes possible vandalising Github History from Powershell
- [github-board](https://github.com/bayandin/github-board) commits gitfiti from easy templates
- [ghdecoy](https://github.com/tickelton/ghdecoy) fills the contribution graph with random data (sneaky!)
- [Gitfiti Painter](http://codepen.io/cbas/pen/vOXeKV) visual drawing tool for artists to easily create templates
- [git-draw](https://github.com/ben174/git-draw) a Chrome extension which will allow you to freely draw on your commit map(!)
- [github-jack](https://github.com/tardypad/github-jack) a pure bash version with space invaders and shining creepypasta
- [github-graffiti](https://github.com/mavrk/github-graffiti) a GUI editor with a bash script to allow custom designs on your commit map
- [Paint GitHub](https://paintgithub.com/) is the most convenient way to paint your GitHub contribution graph!
- [contribution-pixel-messages](https://github.com/abulvenz/contribution-pixel-messages) generates a date plan from an editable GUI
- Seen something else? Submit a pull request or open an issue!
DOOMfiti is released under [The MIT license (MIT)](http://opensource.org/licenses/MIT)
Binary file removed gitfiti-screenshot.png
Binary file not shown.
Binary file removed pixels-large.png
Binary file not shown.
Binary file removed pixels.png
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/test_find_max_daily_commits.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from gitfiti import find_max_daily_commits, parse_contributions_calendar
from DOOM import find_max_daily_commits, parse_contributions_calendar


CONTRIBUTIONS_CALENDAR_SVG = '''\
Expand Down
2 changes: 1 addition & 1 deletion tests/test_str_to_sprite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from gitfiti import str_to_sprite, ONEUP_STR
from DOOM import str_to_sprite, ONEUP_STR


SYMBOLS = '''
Expand Down

0 comments on commit 2beedf9

Please sign in to comment.