Skip to content

Commit

Permalink
Merge branch 'HacktoberfestMunich:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
NoobieBubie1 authored Oct 27, 2023
2 parents 63fdf17 + e30d3f8 commit 36558d6
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 6 deletions.
37 changes: 37 additions & 0 deletions Teams/purple_saints/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
17 changes: 11 additions & 6 deletions Teams/purple_saints/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
FROM subfuzion/netcat
FROM node:16.6.1

ENV X=1285
ENV Y=725
ENV COLOR=f00af0
WORKDIR /app

ENTRYPOINT sh -c "echo -en 'PX ${X} ${Y} ${COLOR}\n' | nc -q1 localhost 1234"
CMD []
COPY package*.json ./

RUN npm install

COPY . .

RUN npx tsc src/first.ts

CMD ["node", "src/first.js"]
52 changes: 52 additions & 0 deletions Teams/purple_saints/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions Teams/purple_saints/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "purple_saints",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Marlon & Juli & Julian",
"license": "ISC",
"dependencies": {
"net": "^1.0.2",
"typescript": "^5.2.2"
},
"devDependencies": {
"@types/node": "^20.8.9"
}
}
52 changes: 52 additions & 0 deletions Teams/purple_saints/src/first.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Socket } from 'net';

const host: string = '10.201.77.56';
const port: number = 4321;
const colors: string[] = ['00ff00', 'e28211', 'ff0000', '99b259', '0000ff'];
const xOffset: number = 50;
const yOffset: number = 50;
const cubeSize: number = 50;

async function main() {
const socket = new Socket();
socket.connect(port, host, () => {
console.log('Connected to Pixelflut server.');

socket.write('SIZE\n');
});

socket.on('data', (data: any) => {
const message: string = data.toString();
if (message.startsWith('SIZE')) {
const answer: string[] = message.split(' ');
console.log(`Detected size: ${answer[1]} x ${answer[2]}`);
startPainting(socket);
}
});

socket.on('error', (err) => {
console.error('Socket error:', err);
});
}

function startPainting(socket: Socket) {
console.log('Painting...');
let step: number = 0;

setInterval(() => {
const color: string = colors[step % colors.length];
console.log(`Color: ${color}`);

let output: string = '';
for (let x = xOffset; x < xOffset + cubeSize; x++) {
for (let y = yOffset; y < yOffset + cubeSize; y++) {
output += `PX ${x} ${y} ${color}\n`;
}
}

socket.write(output);
step++;
}, 500);
}

main();
1 change: 1 addition & 0 deletions Teams/purple_saints/thisTeamIsOwend
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lulw
18 changes: 18 additions & 0 deletions Teams/purple_saints/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ES6",
"module": "CommonJS",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"outDir": "./dist",
"rootDir": "./",
"resolveJsonModule": true
},
"include": [
"/src/*.ts"
],
"exclude": [
"/node_modules"
]
}

0 comments on commit 36558d6

Please sign in to comment.