Skip to content

Commit

Permalink
kusa
Browse files Browse the repository at this point in the history
  • Loading branch information
qb0C80aE committed Oct 7, 2017
0 parents commit 440035f
Show file tree
Hide file tree
Showing 5 changed files with 263 additions and 0 deletions.
104 changes: 104 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# What's this?

Recently, I've heard that now recruiters are picking up skilled engineers by checking a activity graph as known as a green lawn on theirGitHub profile page. So that I guess that if we write a job hunting message on the lawn as a canvas, recruiter will think that engineer is so cool, and contact you immediately.

Yes, just like this.

![what?](https://github.com/qb0C80aE/jobhunting/raw/master/example.png)

# How can I use this?

## Install

First, you need to install `git`. And then, download from the links below.

* [linux/amd64](https://github.com/qb0C80aE/jobhunting/releases/download/0.0.1/jobhunting-linux-amd64.tgz)
* [linux/386](https://github.com/qb0C80aE/jobhunting/releases/download/0.0.1/jobhunting-linux-386.tgz)
* [windows/amd64](https://github.com/qb0C80aE/jobhunting/releases/download/0.0.1/jobhunting-windows-amd64.zip)
* [windows/386](https://github.com/qb0C80aE/jobhunting/releases/download/0.0.1/jobhunting-windows-386.zip)

Please don't forget put these into the PATH enabled directory.

FYI, I don't know how can I build the binaries for MacOS on linux, for now. If you know, please tell me that.

## Create a new repository on your GitHub account

go to `github.com` and create a repository used to draw the text. Any name is good for that.

## Clone the repository

```
$ git clone <your repo url>
```

Make sure that git config user.name and user.email are valid, and the current branch is the default branch of this repository.

## Create some files into the repository directory

* a file used to draw the text, default is grass.txt
* a text contained in this file must be expressed in 50x7 cells, using 0 and 1. 1 indicated the foreground value, and 0 is the background one.
* a file used to put commit messages. default is message.txt
* the file must contains at least one message.

See `githib.com/qb0C80aE/jobhunting/grass.txt` and `githib.com/qb0C80aE/jobhunting/message.txt` as samples.

## Just execute jobhunting in the repository directory

```
$ jobhunting
```

If you have already worked on GitHub and contributed to something, the lawn will be normalized.
In this case, you can use `-s` option to emphasize your text by commiting given times.

```
$ jobhunting -s 50
```

It will commit 50 times per cell.

## Just push

```
$ git push origin master
```

Now check your GitHub profile.

# Note

## How can I change the job hunting message?

Just in case, I've prepared a special service for you.
Try this:

```
$ curl "https://texttobinary.herokuapp.com/proxyart?bg=0&fg=1&size=10&text=JOBHUNTING"
```

Then you can get an output like below.

```
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00010011001110010010100101001011111001001001001100
00010100101001010010100101101000100001001101010010
00010100101001010010100101101000100001001101010000
00010100101110011110100101101000100001001101010110
10010100101001010010100101011000100001001011010010
10010100101001010010100101011000100001001011010010
01100011001110010010011001001000100001001001001110
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
```

Just remove head and tail 2 lines each, and copy the content left into your grass file.

## Do I have to destroy and create the text repository everyday?

Perhaps, you could be rescued by using `hub` command to automate the operation.

# In the first place,

This is a totally crappy software, and give useless loads to GitHub. So, if you have enough common sense, it's supposed that you're aware of that you should not to use this.

Binary file added example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions grass.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
01100001001000111110111101111000100000100110011100
10010001001000110000111101000000100000101001010010
10000001000101010000111101000001010000101001010010
10110001000101011110111101111001010000101001011100
10010001000101010000111101000001110100101001010010
10010001000010010000110101000010001100101001010010
01110001000010011110110101111010001011000110011100
149 changes: 149 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
package main

import (
"bufio"
"errors"
"flag"
"fmt"
"io"
"math/rand"
"os"
"os/exec"
"time"
)

const (
row = 7
col = 50
)

var (
argStrength = flag.Int("s", 1, "commit strength")
argGrassFile = flag.String("g", "grass.txt", "the file name of grass")
argMessageFile = flag.String("m", "message.txt", "the file name of messages")
)

func calculateStartDate() time.Time {
date := time.Now().AddDate(0, 0, -(row * col))
for {
if date.Weekday() == time.Sunday {
return date
}
date = date.AddDate(0, 0, -1)
}
}

func execGitCommit(commitDate time.Time, messages []string) error {
message := messages[rand.Int()%len(messages)]

content := fmt.Sprintf("# %s\n", message)
file, err := os.OpenFile("README.md", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return err
}
defer file.Close()

if _, err = file.WriteString(content); err != nil {
return err
}

cmd := exec.Command("git", "add", "README.md")
cmdMessage, err := cmd.CombinedOutput()

dateString := fmt.Sprintf("%04d/%02d/%02d 00:00:00", commitDate.Year(), int(commitDate.Month()), commitDate.Day())

commitMessage := fmt.Sprintf("'%s'", message)
cmd = exec.Command("git", "commit", "-m", commitMessage, "README.md", "--date", dateString)
cmdMessage, err = cmd.CombinedOutput()
if err != nil {
return errors.New(string(cmdMessage))
}

return nil
}

func main() {

flag.Parse()

grassFile, err := os.Open(*argGrassFile)
if err != nil {
fmt.Fprintf(os.Stderr, "Coudln't read %s\n", *argGrassFile)
os.Exit(1)
}
defer grassFile.Close()

lines := make([][]byte, row)

grassFileReader := bufio.NewReaderSize(grassFile, 128)
for r := 0; r < row; r++ {
line, _, err := grassFileReader.ReadLine()

if len(line) < col {
fmt.Fprintf(os.Stderr, "Cols in the row[%d] in %s < %d\n", r, *argGrassFile, col)
os.Exit(1)
}

if err == io.EOF {
if r < (row - 1) {
fmt.Fprintf(os.Stderr, "Rows in %s < %d\n", *argGrassFile, row)
os.Exit(1)
}
break
} else {
if err != nil {
fmt.Fprint(os.Stderr, err.Error())
os.Exit(1)
}
lines[r] = make([]byte, len(line))
copy(lines[r], line)
}
}

messageFile, err := os.Open(*argMessageFile)
if err != nil {
fmt.Fprintf(os.Stderr, "Coudln't read %s\n", *argMessageFile)
os.Exit(1)
}
defer messageFile.Close()

messages := make([]string, 0, 32)
messageFileReader := bufio.NewReaderSize(messageFile, 128)
for {
line, _, err := messageFileReader.ReadLine()

if err == io.EOF {
break
} else {
if err != nil {
fmt.Fprint(os.Stderr, err.Error())
os.Exit(1)
}
message := make([]byte, len(line))
copy(message, line)
messages = append(messages, string(message))
}
}

if err != nil {
fmt.Fprint(os.Stderr, err.Error())
os.Exit(1)
}

commitDate := calculateStartDate()
for c := 0; c < col; c++ {
for r := 0; r < row; r++ {
data := lines[r][c]
if data != '0' {
for s := 0; s < *argStrength; s++ {
err := execGitCommit(commitDate, messages)
if err != nil {
fmt.Fprintf(os.Stderr, "%s\n", err.Error())
os.Exit(1)
}
}
}
commitDate = commitDate.AddDate(0, 0, 1)
}
}
}
3 changes: 3 additions & 0 deletions message.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Gimme a job!
I'm between jobs!
I'm looking for job!

0 comments on commit 440035f

Please sign in to comment.