Have you ever programmed something that made you sit back and think "wow i'm a fucking genius"? If so post it here

Have you ever programmed something that made you sit back and think "wow i'm a fucking genius"? If so post it here.

Other urls found in this thread:

0x0.st/Lhk.hs
0x0.st/Lhn.hs
0x0.st/Neb.txt
twitter.com/AnonBabble

I had an online database made once, that stored serials + supplemental info. The admin panel was about the same as the frontend, just with the first row being the form input table (you could see the serials below, so you had a frame of reference as to the data you have to input).

You also had shitload of filters and sort options in there, so you could look stuff up based on the supplemental info. The admin was also hooked up so if you add a new entry with a filter present, it will auto fill the filtered values. That way you could set up 5-6 filters to pre-populate everything but the unique serial.

Some time I noticed that there are 10 or so unique patterns as to the filtered data. So I gave them all a separate identifier, and you could just input the serial and select a unique identifier and it would fill the rest automatically.

Then during testing I found out that you could set up a filter for that identifier as well... it was so goddamn useful that way, I just pick a dropdown filter, click on add-new, then enter the serial, and all supplemental info is automatically set. Need to pre-sort the serials I want to add first, but once I do that, I can do 1000+ entries in a weekend.

Bro that sounds so boring that i didnt bother trying to understand what you wrote

Omegle clone w/o flash (And some other stuff)
Twitch clone w/o flash (Nearly done with basic functionality)

That's really it desu

And that is why you are a shitty coder.

import math
print("your so smart")
print("2+3={}".format(math.mean([2,3])))

Not the guy you replied to but why are you insulting me

I made a webapp that plays movies & tv shows from my raspberry pi onto my tv

Fuck you too.

Counter thread?

Inspired by it

I just finished writing a program that encrypts communication between a client and a server. Pretty proud that I got it done, but it was also my first time using C++, so it probably looks like a godawful mix of C and C++ to anyone else

>seinfeld
>star trek
>The crocodile Hunter
>super Jail
thats some good taste in anime senpai

what algorithm does it use?

The final product uses Diffie-Hellman to generate a key and RSA for authentication. It was fun to write and complete on my own, but it also had me use OpenSSL which I think has some of the worst documentation I've ever seen.

The whole reason I did it was for the Honors Program at my uni, but I found the project requirements themselves at another uni. Valuable learning experience though.

No, but everyday I write shit and realize my co-workers are fucking retarded

Neural network playing breakout from pixel input

I work for a live TV streaming company in the UK.
We had a 2d scrolling TV guide, but it was on the slow side, plus it had some issues on older/lower powered devices. So I set about refactoring the code. I wrote a custom layout class for UICollectionView that mapped the TV guide data into a collection of layout frames. This took about 0.02 seconds, removing the overhead of dynamically generating the location of each view while dequeuing. This left the guide scrolling at 60 fps on even low end hardware. And the code was platform agnostic meaning we could port the code to Apple TV.

...

Everyday

I made an image displayer for minecraft on the raspberry pi


Nice, is it locally stored movies and tv shows, or do you grab them from some website/service?

>UICollectionView
Is this for an iPhone app?

I wrote an assembler this semester. That was pretty cool I guess.
I didn't particularly feel smart, it was actually pretty basic.

float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;

x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed

return y;
}

No but I have had those moments where I can't figure out a solution to something for days, have a drink, immediately write the code and then the next day don't understand why it works. It's like someone better than me wrote it but it was myself who did.

>// what the fuck?
gets me every time

Most boring man I've ever seen

Have you ever programmed AI in HTML and CSS?

I wrote a function to overcome the memes.
Instead of just averaging two ints in C, it averages an arbitrary number of ints, without overflow or conversion to a larger/floating type.
#include

/**
* Averages an array of integers.
*
* Averages an array of integers, without overflow or conversion to a larger type.
* It is equivalent to the sum of the array, divided by the array's length (rounded towards zero).
*
* @param n Number of array elements. Must be greater than zero.
* @param arr A pointer to an array of n integers. Must be non-null.
* @return The mean of the array's elements.
*/
int iavg(int n, const int arr[static const n])
{
int avg = 0;

/* A buffer of values that are lost to integer truncation.
* It should always be in the closed interval (-n, n).
*/
int error = 0;

for (int i = 0; i < n; ++i) {
avg += arr[i] / n;

int loss = arr[i] % n;

// error + loss >= n
if (error > 0 && loss > 0 && error >= n - loss) {
// error = (error + loss) - n
error -= n - loss;
++avg;

// error + loss 0 && error < 0)
--avg;

return avg;
}

int main(int c, char **v)
{
while (--c > 1 && !fork());
sleep(c = atoi(v[c]));
printf("%d\n", c);
wait(0);
return 0;
}

too l8 m8

Implemented Binary Tree using 1 dimensional array

#!/usr/bin/env python

import sys

if sys.version_info < (3,0):
import Tkinter as tkinter
import tkMessageBox as mbox
else:
import tkinter
import tkinter.messagebox as mbox

window = tkinter.Tk()
window.wm_withdraw()

mbox.showerror('Virus Alert!','Hi, I am an Albanian virus but because of poor technology in my country unfortunatly I am not able to harm your computer. Please be so kind to delete one of your important files yourself and then forward me to other users. Many thanks for your cooperation! Best regards, Albanian virus.'

+)

top

while (True):
i = 0
if i % == 3 and i % 5 == 0:
print("Fizzbuzz")
elif i % 3 == 0:
print("Fizz")
elif i % 5 == 0:
print("Buzz")
else:
print(i)
i += 1

Yes, I programmed a few things that made me proud. Fuck if I can remember what any of them were.

Public Function FizzBuzz(QUERY)
If QUERY Mod (3*5) = 0 Then
FizzBuzz = "FizzBuzz"
ElseIf QUERY Mod 3 = 0 Then
FizzBuzz = "Fizz"
ElseIf QUERY Mod 5 = 0 Then
FizzBuzz = "Buzz"
Else
FizzBuzz = QUERY
End If
End Function

Yes, but due to how long ago it was I dont remember what exactly it was.
Ive done alot of nigger rigging and gotten shit to work that should have been incompatible with each other,
Ive done stuff like when my hardware was failing and I couldn't get a movie on the tv or transfer it to usb, put samba on pc 1, mounted it on pc 2, set up dlna on pc 2, and pointed it at the remote mount of pc 1's media directory, and watched it on the xbox from two computers away. mfw it didnt lag.

>Have you ever programmed something that made you sit back and think "wow i'm a fucking genius"? If so post it here.
0x0.st/Lhk.hs

the elegance of using a dependent map to have heterogeneous key-indexed dictionaries while forcing a shared property (semigroup) on them nearly made me cry

The reason I felt so satisfied about it is because I was working out how to solve this problem on paper and came to the conclusion that I needed something like a dependent map and began to wonder if I needed a dependently typed language to implement this properly, so I began describing ‘DMap’ (even using that name) to #haskell in the hopes of somebody already having tackled a problem like this, and it turns out that ‘DMap’ both literally existed with exactly that name and was literally exactly what I needed it to be

only wart in that code is the reliance on a hand-written GCompare instance, but that would be trivial to solve with template haskell if you need it for any larger type

Also I found these in my haskell folder while looking for examples and I barely even remember writing them

0x0.st/Lhn.hs (polymorphic)
0x0.st/Neb.txt (monomorphic)

Don't remember what problem I was solving but horrible abuse of the haskell type system like that always makes me feel a sense of accomplishment. Trying to simulate something like dependent typing in a non-DT language evokes the hacker spirit within me.

It's similar to the feeling I get when trying to force haskell type system concepts into something like C#.

When I implemented process swapping for this browser OS I wrote, albeit not perfect, I felt pretty damn accomplished

i needed su in a very early state of Linux from Scratch, so i used chroot to switch to user.
root:/tools/bin# cat su
if [ $# -eq 1 ]; then
set -- "$1" "$1"
fi
chroot --userspec=$2 "/" /tools/bin/env -i HOME=/usr/src/$2 TERM="$TERM" PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h

What architecture?

>coder

The irony is palpable.

...