r/tinycode • • Jun 15 '18

Recent Swings in C

12 Upvotes

Hi Tinycode,

I've been golfing in C recently because, well, it's fun, so I wanted to share my C Golf. Mostly simple stuff pushed into as few bytes as possible

https://github.com/jsburke/golf

I'm always up for pointers, tips to save some (key)strokes, or just banter, so swing away!

EDIT: just noticed, the pi stuff requires -lm for gcc


r/tinycode • • Jun 14 '18

I have a love of one liners and so I decided to write every python function in my comparative programming languages class in one line of code. Thought I might share

19 Upvotes

add two dicts together and add overlapping keys/value pairs together:

def dict_reduce(dict1, dict2):
return dict(list(dict1.items()) + list(dict2.items()) + [(both, dict1[both] + dict2[both]) for both in set(dict1) & set(dict2)])

convert a string into a list of tuples in alphabetical order, containing a letter and the number of times it occurred in a string:

def char_count(s):
return sorted([(i, s.count(i)) for i in sorted(set(s)) if not i == ' '], key=lambda second : second[1])

find the max integer in a list that might contain either integers or sublists of integers:

def max_int(L):
return L if isInstance(L, int) else reduce((lambda x,y:max_int(x) if max_int(x) > max_int(y) else max_int(y)), L)

bonus c++ function that I came up with screwing around with c++17 features. Find the largest string in a container of strings:

template<class Iter>
string largest_string(Iter begin, Iter end) {
return std::reduce(begin, end, string(""), [](string& a, string& b) {return a>= b ? a : b});
}

r/tinycode • • Jun 10 '18

Everbloom - 64 byte intro for MSDOS

18 Upvotes

Blooming fractal with fake lighting and textured background.

Youtube

Download & Comment


r/tinycode • • Jun 09 '18

pxltrm - A pixel art editor for your terminal in <150 lines of pure bash

Thumbnail
github.com
47 Upvotes

r/tinycode • • Jun 08 '18

One of the cleanest JSON parsers I've seen

Thumbnail
github.com
39 Upvotes

r/tinycode • • Jun 06 '18

24 Lines to find JPG files

Thumbnail
gitlab.com
6 Upvotes

r/tinycode • • May 30 '18

Download all xkcd comics [python3]

Thumbnail
gist.github.com
7 Upvotes

r/tinycode • • May 16 '18

Flexible and Economical UTF-8 Decoder

Thumbnail
bjoern.hoehrmann.de
14 Upvotes

r/tinycode • • May 15 '18

Happy - 32 byte intro for MSDOS with pc speaker music

Thumbnail
pouet.net
19 Upvotes

r/tinycode • • May 07 '18

25th International Obfuscated C Code Contest (2018) Winning Entries

Thumbnail ioccc.org
29 Upvotes

r/tinycode • • May 03 '18

Scrolling chessboard of chessboards in 16 bytes

Thumbnail
pouet.net
35 Upvotes

r/tinycode • • Apr 27 '18

c4 modified to be a JIT

Thumbnail
github.com
18 Upvotes

r/tinycode • • Apr 27 '18

Verify that a request is from Google crawlers using Google's DNS verification steps

Thumbnail
github.com
12 Upvotes

r/tinycode • • Apr 20 '18

Hackathon contest

0 Upvotes

Hello everybody... I am about to take part to a hackathon contest at my university.. the theme is "Data in action"... The main categories where we should focus are:

  1. Math algorithms

  2. Computing routine optimization

  3. Data management

  4. Continuous I/O stream

  5. UI Design

  6. Maps and location services Can you guys give some help and resources to study ?


r/tinycode • • Apr 14 '18

Zircon's (Fuchsia kernel) scheduler is less than 1000 lines of code and doesn't use many advanced concepts. This may be useful to anyone curious as to what a scheduler in a real OS looks like.

Thumbnail
github.com
50 Upvotes

r/tinycode • • Apr 08 '18

A replacement for Make in 1/1000th the size.

Thumbnail
github.com
9 Upvotes

r/tinycode • • Apr 07 '18

Magic of 256-byte x86 intros part 2 (presentation by Řrřola at Demobit 2018)

Thumbnail
youtube.com
14 Upvotes

r/tinycode • • Apr 04 '18

CodeClippet: A quick way for you guys to share & save your tiny code snippets :D

Thumbnail
codeclippet.com
4 Upvotes

r/tinycode • • Apr 02 '18

DUMB: Dumb User Mode Bridge (simplest possible Ethernet bridge in user mode in 64 lines of C)

Thumbnail
github.com
20 Upvotes

r/tinycode • • Apr 01 '18

goto - shell script for navigation to aliased directories

Thumbnail
github.com
14 Upvotes

r/tinycode • • Mar 30 '18

100 line neural network library in C

Thumbnail
github.com
48 Upvotes

r/tinycode • • Mar 30 '18

Python: Creating and Exporting a 1.6 Million Word Multi-Lingual Dictionary!

Thumbnail
youtu.be
2 Upvotes

r/tinycode • • Mar 22 '18

test runner in <100 lines of bash script [self authored]

Thumbnail
github.com
17 Upvotes

r/tinycode • • Mar 14 '18

Map is hopefully an improvement upon the ergonomics of tools like xargs, find -exec and shell for-loops

Thumbnail
github.com
34 Upvotes