[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Tiny programming projects
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 69
Thread images: 5
File: 1444408034408.jpg (855 KB, 1920x1080) Image search: [Google]
1444408034408.jpg
855 KB, 1920x1080
Quick /g/!

Gimme something I can write in C in half an hour to put in my new Github
>>
game of life
>>
Write an emulator for some 8 bit CPU or maybe even a whole computer/console from the 80s.
It's more than half an hour but in my experience people notice that the most often. And it's not that hard.
>>
>>53559663
>in half an hour
>>
>>53559675
I know it isn't, I wrote one once. However, I just want something little to start off, since I am switching over accounts.
>>
>>53559653
A program that replaces the entire contents of a file with "lolol" stopping at the exact character the original file ends at including whitespace attention and punctuation.

INPUT:

She sells sea shells
by the sea shore.

OUTPUT:

lol ollol oll olollo
lo llo lol lolol.
>>
>>53559679

https://en.wikipedia.org/wiki/Conway's_Game_of_Life

You literally just have to check for 4 rules on every element.

How hard could that possibly be?
>>
File: 1458242644644.jpg (84 KB, 473x473) Image search: [Google]
1458242644644.jpg
84 KB, 473x473
>>53559653
AI that plays Go.
>>
>>53559719
Didn't say it was hard. Just something really quick.

>>53559713
That's more like it
>>
Log parser. Takes a log file as input and provides a 2D array (or other data structure of choice) where Y lines are log line # and X lines are each segment of that line.

Ex:

[5:29:34 3/18/16] INFO Application start successful

is now

[ time ] [ date ] [ loglevel ] [ logline ]

Bonus points if you can handle error/stacktraces.
>>
>>53559653
ok I have something that I want to make but am too stupid to make, I am learning programming so I can make stuff like this but dont know enough yet, it should not be too hard tho?

So I use imagus for image hover and image downloading

can you make a program/extension that does the following:

1) in chrome if you attempt to download a file twice it just renames the second one, can you make it so it STOPS the download instead? e.g. if I tried to download https://i.4cdn.org/g/1458336249236.jpg twice, the second one would cancel
like this but actually works
http://hnng.moe/6c9

2) can you make it so that the image is sorted to a folder based on filetype, like all jpegs are sent to /downloads/jpeg

3) so in imagus when you hover and click ctrl s it saves the image, can you make if I click additional keystrokes in a time period like 1 second, it sorts it to an additional folder? like
ctrl s --> a
would save a jpeg into /downloads/jpeg/anime_girl
>>
>>53559798
>half an hour
>in C
>>
>>53559845
idk man

what kinda programming language should i learn to do stuff like this?

also it shouldnt be too hard right? like all it does is just sort images based on filetype into folders, a batch file that's 1 line can do that
>>
>>53559653
FizzBuzz.
>>
>>53559865
Any language can do it, but if you want it done quickly try something like python. It still sounds like it would take longer than half an hour, at least in what I program in.
>>
>>53559865

Technically you can do anything in one line of bash, so that's not very helpful. ;)
>>
>>53559876
>half an hour

Literally anybody can do this in like 5 minutes unless its in a meme lang like brainfuck
>>
build a turing machine emulator
>>
>>53559968
So it fulfils the in half an hour requirement.

Unless you want something that takes exactly half an hour.
>>
>>53559887
How hard would it be to make something like imagus for youtube videos?

so that, when you hover over a youtube link, the video plays

imagus can play webms really well, a while back imagus could play youtube vids with a small modification but youtube changed something in like 2010 to make their vids more secure

what it did before was convert the vid to a webm then played it i think

how do i go about learning to make youtube extensions

fuck I dont even care about learning programming I just want my meme consumption tools to be improved, programming is worthless, waste of space in my brain
>>
>>53560003
preferably
>>
>>53559653
Privilege checker
>>
>>53559713
This is shit code but i did it in about 34 minutes
#include <stdio.h>
#include <stdlib.h>


const static int SUCCESS = 0;
const static int FAIL = 1;
const static char MIN_ALPHA = 'A';
const static char MAX_ALPHA = 'z';


int getFileSize(FILE *sizeToGet);

int main(int argc, char *argv[])
{
FILE *fp;
int size, i;
char *fileContents;
if(!argv[1])
{
printf("You need to input a filename!\n");
return FAIL;
}
fp = fopen(argv[1], "rb");
size = getFileSize(fp);
fileContents = calloc(sizeof(char), size + 1);
fread( fileContents , size , 1 , fp );
fileContents[size] = '\0';
fclose(fp);
for(i = 0; i < size; i++)
{
if(fileContents[i] > MIN_ALPHA && fileContents[i] < MAX_ALPHA)
{
if(i % 2 == 0)
{
fileContents[i] = 'l';
}
else
{
fileContents[i] = 'o';
}

}

}
fp = fopen(argv[1], "wb");
fwrite(fileContents, sizeof(char), size, fp);
fclose(fp);
free(fileContents);

return SUCCESS;
}

int getFileSize( FILE *sizeToGet)
{
int fileSize = 0;
fseek( sizeToGet , 0 , SEEK_END );
fileSize = ftell( sizeToGet );
rewind( sizeToGet );//back to the start, as without this we cannot load the contents
if(errno > 0)
{
fprintf( stderr , "ftell has failed : %s" , strerror( errno ) );
return FAIL;
}
return fileSize;

}
>>
>>53559653
Genetic algorithm applied to playing pong.
>>
>>53560262
I would be interested to see this done in half an hour.

Is it as hard as it sounds?
>>
>>53560189
this

Input:
Nigger

Output:
false
>>
>>53560262
what would be a chromosome in that?
>>
>>53559653
Privilege checker or windows malware
>>
>>53560377
I know that windows is fucked security wise, but what can you really do to damage the internals of a computer in half an hour?
>>
>>53560300
Its really easy if you know what to do.
1) write pong that can be controlled by a procedure ( you give it screen state as argument and get a control command: left, right, pass)
2) write a universal control procedure that transforms inputs to commands by a rule that depends on array of bytes ( the genetic code). That may be a decision tree, a neural net, a simple virtual CPU that executes those bytes as some ops (you should also give it data then) or anything you can think of. The only condition is that there should exist a genetic code ( particular set of bytes) that makes your procedure do what you want.
3) initialize your genetic code randomly N times, play pong with it, measure score, mutate, breed, repeat.

Actually I became interested in it myself, I will write it in JS.
>>
>>53560419
disable the USB bus lol 10 min to code if that
>>
>>53559653
If you can do it in half an hour, it's 99.999% certain it's not worth putting on GitHub.
>>
>>53560593
Why would I do that, that's not a fun way to fuck with people.

You want them to know you're the big bad virus


>>53560584
That's sounds pretty cool, shame I don't have half an hour to write pong as well.
>>
>>53559653

FizzBuzz
>>
>>53560360
I'd go with a decision tree or a neural net. Or a lightweight virtual CPU.

The input is, say, 8x16 array of bytes (1 is ball, 2 is your pad, 3 is the opponents), the output is 0 (pass) or 1(move left) 2(move right)
>>
>>53560634
Write a pong then, a decent project too.
>>
>>53559653
FizzBuzz
/thread
>>
>>53560841
>>53560657
>half an hour

It doesn't take 25 minutes to jack off once you're done.
>>
Write a snake in C+SDL, anon!
>>
>>53560966
Like the game or just a snake?
>>
File: fuckingimage.png (302 KB, 1920x1080) Image search: [Google]
fuckingimage.png
302 KB, 1920x1080
/thread
>>
echo with XSI-conformance
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
>>
>>53561024
>Dungeons and Dragons with AI
>Genetic algorithms on polygons

i'm sure they're quick

>Dijstra's algorithm

The first time I wrote that in C it took me 3 hours.
>>
>>53561024
rolling
>>
>>53561024
Roll
>>
Tic tac toe.
>>
>>53561024
roll
>>
>>53561024
roll
>>
>>53561024
rollen
>>
>>53559798
>>53559865
That kind of stuff sounds like it would be done with a browser extension. Those are usually HTML/JS with specific functions for the browser
>>
>>53559653
A quiz that contains 50 questions and serves 4 answers (1 correct) in random order.
Must also have a high-score list and fancy colours

Took me about 1 hour in ruby as a noob
>>
>>53561024
muh kekkingtons
>>
>>53562300
Bonus Points:
-it changes the order of choices each time it's run
-it only penalizes half points on the first incorrect answer
>>
>>53562710
Well not to toot my own horn here, but I did say "in random order" (thus not predefined) and I had a timer with a system that would reward more the faster youd give the correct answer:^)
>>
>>53562741
I did that exact thing in visual basic.. I don't really know why I felt the need to complicate the assignment back I high school
>>
>>53562800
I made it for one of my first college class hand-ins and all I got from the teacher was "looks okay"

They never even tested it. hold me anon people are not fun.
>>
>>53562300
>took me about an hour in ruby as a noob
blatant lie

>op asked for c
>what are colors
>what is gui
>i don't know what i'm talking about

>>53559653
write a b tree phone book. if you have time left, count branch weight and index the nodes, then balance. still time? write a quick sort on your tree. half an hour still going strong? invent an easy markup language, parse the LA phonebook through it all, randomize, print to somwhere, sort again, store away. still time? write CLI UI. and so on.
>>
>>53563020
Never said I made it in C. Made it in Ruby.
>what are colours in CMD
>implying GUI

And your idea sucks and is no fun.
>>
Make a chat server/client. Add encryption and proxies if you feel like it
>>
>>53559679
if you can't make a quick ascii representation of the game of life you should just quit now

stick to the web-dev general thread
>>
>>53563381
I never said I couldn't. I said I couldn't do it in half an hour

>>53563020
Phone book sounds interested

>>53563326
Been there, done that, bought the t shirt.
>>
>>53561024
here goes nothin
>>
>>53561024
Bump.
>>
>>53561024
roll me
>>
File: friday_night_3.png (210 KB, 854x1006) Image search: [Google]
friday_night_3.png
210 KB, 854x1006
>>53560593
Sauce on code that does this?
>>
>>53561024
roll
>>
https://better-dpt-roll.github.io/
>>
>>53561024
roll/bump
>>
>>53565254
>requires external scripts
Thread replies: 69
Thread images: 5

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.