-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'HacktoberfestMunich:main' into main
- Loading branch information
Showing
7 changed files
with
189 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lulw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} |