about summary refs log tree commit diff stats
path: root/tools/conf/etc/logrotate.conf
blob: 896b7798df3ab557f2b0d1615147785214eb3130 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
compress

olddir /var/log/old

notifempty

maxsize 5M

# some packages can drop log rotation information into 
# this directory
include /etc/logrotate.d

# few generic files to rotate
/var/log/wtmp {
    create 0644 root root
    rotate 5
}

/var/log/btmp {
    create 0600 root root
    rotate 5
}

# system-specific logs may be also be configured here.
/var/log/faillog {
    maxsize 5M
}

/var/log/lastlog {
    maxsize 5M
}

/var/log/auth {
    create 0644 root root
    rotate 5
    sharedscripts
    postrotate
    if [ -f /var/run/syslog-ng.pid ]; then \
    	kill -HUP `cat /var/run/syslog-ng.pid`; \
    fi;
    endscript
}

/var/log/cron {
    create 0644 root root
    rotate 5
    sharedscripts
    postrotate
    if [ -f /var/run/syslog-ng.pid ]; then \
    	kill -HUP `cat /var/run/syslog-ng.pid`; \
    fi;
    endscript
}

/var/log/debug {
    create 0644 root root
    rotate 5
    sharedscripts
    postrotate
    if [ -f /var/run/syslog-ng.pid ]; then \
    	kill -HUP `cat /var/run/syslog-ng.pid`; \
    fi;
    endscript
}

/var/log/kernel {
    rotate 5
    create 0644 root root
    sharedscripts
    postrotate
    if [ -f /var/run/syslog-ng.pid ]; then \
    	kill -HUP `cat /var/run/syslog-ng.pid`; \
    fi;
    endscript
}

/var/log/daemon {
    compress
    rotate 5
    create 644 root root
    sharedscripts
    postrotate
    if [ -f /var/run/syslog-ng.pid ]; then \
    	kill -HUP `cat /var/run/syslog-ng.pid`; \
    fi;
    endscript

}

/var/log/messages {
    rotate 5
    create 0644 root root
    sharedscripts
    postrotate
    if [ -f /var/run/syslog-ng.pid ]; then \
    	kill -HUP `cat /var/run/syslog-ng.pid`; \
    fi;
    endscript
}

/var/log/mail {
    create 0644 root root
    rotate 5
    sharedscripts
    postrotate
    if [ -f /var/run/syslog-ng.pid ]; then \
    	kill -HUP `cat /var/run/syslog-ng.pid`; \
    fi;
    endscript
}

/var/log/user {
    create 0644 root root
    rotate 5
    sharedscripts
    postrotate
    if [ -f /var/run/syslog-ng.pid ]; then \
    	kill -HUP `cat /var/run/syslog-ng.pid`; \
    fi;
    endscript
}
ht .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
// TODO: if there are no more levels show a "game win" message

// Game constants
const canvas = document.getElementById('gameCanvas');
const ctx = canvas.getContext('2d');
canvas.width = 800;
canvas.height = 600;

const GRAVITY = 4;
const JUMP_STRENGTH = -33;
const MOVE_SPEED = 7;

let keys = { left: false, right: false, up: false, down: false, space: false };

let levels = [
    [
        // Next level example
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5],
        [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
    ],
    [
        [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
        [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
    ]
    // Add more levels as needed
];

let currentLevel = 0;

class Player {
    constructor(x, y) {
        this.x = x;
        this.y = y;
        this.width = 30;
        this.height = 30;
        this.velocityX = 0;
        this.velocityY = 0;
        this.jumping = false;
        this.doubleJumping = false;
    }

    update() {
        if (keys.left) this.velocityX = -MOVE_SPEED;
        if (keys.right) this.velocityX = MOVE_SPEED;
        if (!keys.left && !keys.right) this.velocityX = 0;

        this.velocityY += GRAVITY;
        this.x += this.velocityX;
        this.y += this.velocityY;

        // Collision detection
        this.checkCollision();

        // Limit falling speed
        if (this.velocityY > 10) this.velocityY = 10;
    }

    jump() {
        if (!this.jumping) {
            this.velocityY = JUMP_STRENGTH;
            this.jumping = true;
        } else if (!this.doubleJumping) {
            this.velocityY = JUMP_STRENGTH;
            this.doubleJumping = true;
        }
    }

    checkCollision() {
        let row, col, belowRow, aboveRow, leftCol, rightCol;

        // Check collision with ground from below
        row = Math.floor(this.y / 30);
        col = Math.floor(this.x / 30);
        belowRow = Math.floor((this.y + this.height) / 30);

        if (levels[currentLevel][belowRow] && levels[currentLevel][belowRow][col] === 1) {
            if (this.velocityY > 0) {
                this.y = belowRow * 30 - this.height;
                this.velocityY = 0;
                this.jumping = false;
                this.doubleJumping = false;
            }
        }

        // Check collision with ground from above
        aboveRow = Math.floor((this.y - 1) / 30);
        if (levels[currentLevel][aboveRow] && levels[currentLevel][aboveRow][col] === 1) {
            if (this.velocityY < 0) {
                this.y = (aboveRow + 1) * 30;
                this.velocityY = 0;
            }
        }

        // Check collision with ground from the left
        leftCol = Math.floor(this.x / 30);
        if (levels[currentLevel][row] && levels[currentLevel][row][leftCol] === 1) {
            if (this.velocityX < 0) {
                this.x = (leftCol + 1) * 30;
                this.velocityX = 0;
            }
        }

        // Check collision with ground from the right
        rightCol = Math.floor((this.x + this.width) / 30);
        if (levels[currentLevel][row] && levels[currentLevel][row][rightCol] === 1) {
            if (this.velocityX > 0) {
                this.x = rightCol * 30 - this.width;
                this.velocityX = 0;
            }
        }

        // Collision with lava
        if (levels[currentLevel][row] && levels[currentLevel][row][col] === 2) {
            this.reset();
        }

        // Collision with save point
        if (levels[currentLevel][row] && levels[currentLevel][row][col] === 3) {
            localStorage.setItem('savePoint', JSON.stringify({ x: this.x, y: this.y, level: currentLevel }));
        }

        // Collision with goal
        if (levels[currentLevel][row] && levels[currentLevel][row][col] === 5) {
            alert('Level Complete!');
            loadNextLevel();
        }
    }

    reset() {
        let savePoint = JSON.parse(localStorage.getItem('savePoint')) || { x: 30, y: 30, level: 0 };
        this.x = savePoint.x;
        this.y = savePoint.y;
        currentLevel = savePoint.level;
        this.velocityY = 0;
    }

    render() {
        ctx.fillStyle = 'blue';
        ctx.fillRect(this.x, this.y, this.width, this.height);
    }
}

function findPlayerStartPosition(level) {
    for (let row = 0; row < levels[level].length; row++) {
        for (let col = 0; col < levels[level][row].length; col++) {
            if (levels[level][row][col] === 4) {
                return { x: col * 30, y: row * 30 };
            }
        }
    }
    // Default position if no start point found
    return { x: 30, y: 570 };
}

function renderLevel() {
    for (let row = 0; row < levels[currentLevel].length; row++) {
        for (let col = 0; col < levels[currentLevel][row].length; col++) {
            if (levels[currentLevel][row][col] === 1) {
                ctx.fillStyle = 'brown';
                ctx.fillRect(col * 30, row * 30, 30, 30);
            } else if (levels[currentLevel][row][col] === 2) {
                ctx.fillStyle = 'red';
                ctx.fillRect(col * 30, row * 30, 30, 30);
            } else if (levels[currentLevel][row][col] === 3) {
                ctx.fillStyle = 'green';
                ctx.fillRect(col * 30, row * 30, 30, 30);
            } else if (levels[currentLevel][row][col] === 5) {
                ctx.fillStyle = 'gold';
                ctx.fillRect(col * 30, row * 30, 30, 30);
            }
        }
    }
}

function loadNextLevel() {
    currentLevel++;
    if (currentLevel >= levels.length) {
        alert("You've completed all levels!");
        currentLevel = 0;
    }
    let startPosition = findPlayerStartPosition(currentLevel);
    player.x = startPosition.x;
    player.y = startPosition.y;
    player.velocityY = 0;
    localStorage.setItem('savePoint', JSON.stringify({ x: player.x, y: player.y, level: currentLevel }));
}

let startPosition = findPlayerStartPosition(currentLevel);
let player = new Player(startPosition.x, startPosition.y);

function gameLoop() {
    ctx.clearRect(0, 0, canvas.width, canvas.height);

    renderLevel();
    player.update();
    player.render();

    requestAnimationFrame(gameLoop);
}

document.addEventListener('keydown', (e) => {
    if (e.code === 'ArrowLeft') keys.left = true;
    if (e.code === 'ArrowRight') keys.right = true;
    if (e.code === 'ArrowUp') keys.up = true;
    if (e.code === 'ArrowDown') keys.down = true;
    if (e.code === 'Space') player.jump();
});

document.addEventListener('keyup', (e) => {
    if (e.code === 'ArrowLeft') keys.left = false;
    if (e.code === 'ArrowRight') keys.right = false;
    if (e.code === 'ArrowUp') keys.up = false;
    if (e.code === 'ArrowDown') keys.down = false;
});

gameLoop();