Posted June 14, 2013 · Original PosterOP The goal here is to make a useful program, that an end user is capable of using, that is under 100 lines! Ofcourse anything near 100 lines is awesome too, try to keep it fairly close though! Please either link your source (if using an external site like pastie or github:gist) or use code tags for example: [code]Code here[ /code] Here are some of my programs:Biology Protein acronym converter: https://gist.github.com/fletchto99/5786050Official LTT Story generator: https://gist.github.com/fletchto99/5786808 Screen Snapper: https://gist.github.com/fletchto99/5788659 There are 10 types of people in this world, those who can read binary and those who can't. There are 10 types of people in this world, those who can read hexadecimal and F the rest. ~Fletch Link to post Share on other sites
Posted June 14, 2013 · Original PosterOP Pinned :) Thanks a ton! :) There are 10 types of people in this world, those who can read binary and those who can't. There are 10 types of people in this world, those who can read hexadecimal and F the rest. ~Fletch Link to post Share on other sites
Posted June 15, 2013 Here is my point slope calculator in Pascal. Sorry that I don't have it compiled yet (I'm working on my Windows machine, so I'm using my Linux PC) https://sourceforge.net/projects/gingersmathform/files/? System: CPU: 4670k | Mobo: Gigabyte Z87MX D3H | RAM: 8gb 1600Mhz | Case:Corsair 350D | PSU: Corsair CX430, to be upgraded soon | GPU: HD4600, to be upgraded soon Dogecoin: D787N1VP3JaK3wmKehWhqGXBvspZpQ4YFV Link to post Share on other sites
Posted June 15, 2013 although i like the idea. do we keep copyright? Rig: Intel i7 920 D0 @3.5 | gtx970 | 12 gig Balistix 1333 @ 8-8-8-24 | 2x1TB Spinpoint F3 Raid 0 | 1TB Spinpoint F3 |samsung 840 evo| Thermaltake 850w Tp | Xfi extreme gamer | Antec 902 Peripherals: Samsung syncmaster 2494hs @1920/1080 - 60Hz | Q-pad MK85 | g502 | Razor Destructor | Logitech G930 | Logitech 3D pro xtreme | 360 pad | Nitro Wheel Link to post Share on other sites
Posted June 15, 2013 This is no issue if you don't care about how readable it is! :P Link to post Share on other sites
Posted June 15, 2013 Under 100 lines... does that include comments? This might be fun :) 3930k | RIVBE | 32GB Dominator Plat. | Titan XP | Intel 750 1.6TB | Mellanox 10Gb NIC | AX1200i Custom TJ07 | 2xD5 pumps | EK Supremacy EVO | EK Titan XP | EK RIVBE Block | Cu Tubing | 25x120mm Rad Samsung U28D590D 4K | Leopold Otaku w/Browns | Corsair M65 | Corsair SP2500 | Sennheiser HD595 Link to post Share on other sites
Posted June 15, 2013 Here is my point slope calculator in Pascal. Sorry that I don't have it compiled yet (I'm working on my Windows machine, so I'm using my Linux PC) https://sourceforge.net/projects/gingersmathform/files/? I love it! I'm thinking of recommending it to my next math teacher I get my senoir year! :) Link to post Share on other sites
Posted June 15, 2013 (edited) At 105 lines, so close, so far away. Edit: Remembered one, Distance Formula, Slope, and Mid Point calculator. Made for mac. No link because I just don't feel like uploading it tonight. Edited June 15, 2013 by xxTigerShark My Rig: i5 3570k at 4.2 GHz 1.12 Volts, Hyper 212 Evo, Maximus V Gene, RM650, 840 Pro and Seagate Barracuda, 8 GB of Sniper Ram, and a GTX 770. Link to post Share on other sites
Posted June 15, 2013 I can make the most useful program in 1 line. Remove all white spaces ^-^. Link to post Share on other sites
Posted June 15, 2013 here is the pretty version: https://docs.google.com/file/d/0B0N8oqtmHVglbVdyQmJRUWp5bUk/edit?usp=sharing ------------{asks user for number}-------------print("type a number") local input = tonumber(io.read())----------{split number into digits within a table}----------- local Digit = {tonumber(string.sub(input, 1, 1)), tonumber(string.sub(input, 2, 2)), tonumber(string.sub(input, 3, 3))}local length = string.len(input)--------------{convert to number}-------------- local lengthNumber = tonumber(length)-----------{writing out the number}------------if lengthNumber == 1 thenif tonumber(input) == 1 thenio.write("One\n")endif tonumber(input) == 2 thenio.write("Two\n")endif tonumber(input) == 3 thenio.write("Three\n")endif tonumber(input) == 4 thenio.write("Four\n")endif tonumber(input) == 5 thenio.write("Five\n")endif tonumber(input) == 6 thenio.write("Six\n")endif tonumber(input) == 7 thenio.write("Seven\n")endif tonumber(input) == 8 thenio.write("Eight\n")endif tonumber(input) == 9 thenio.write("Nine\n")endendif (lengthNumber == 2 and Digit[1] == 1) thenif Digit[2] == 0 thenio.write("Ten\n")endif Digit[2] == 1 thenio.write("Eleven\n")endif Digit[2] == 2 thenio.write("Twelve\n")endif Digit[2] == 3 thenio.write("Thirteen\n")endif Digit[2] == 4 thenio.write("Fourteen\n")endif Digit[2] == 5 thenio.write("Fifteen\n")endif Digit[2] == 6 thenio.write("Sixteen\n")endif Digit[2] == 7 thenio.write("Seventeen\n")endif Digit[2] == 8 thenio.write("Eighteen\n")endif Digit[2] == 9 thenio.write("Nineteen\n")endendif (lengthNumber == 2 and Digit[1] == 2) thenio.write("Twenty")if Digit[2] == 1 thenio.write("One\n")endif Digit[2] == 2 thenio.write("Two\n")endif Digit[2] == 3 thenio.write("Three\n")endif Digit[2] == 4 thenio.write("Four\n")endif Digit[2] == 5 thenio.write("Five\n")endif Digit[2] == 6 thenio.write("Six\n")endif Digit[2] == 7 thenio.write("Seven\n")endif Digit[2] == 8 thenio.write("Eight\n")endif Digit[2] == 9 thenio.write("Nine\n")endend LUA this is my first real world application program, however it is not finished it only accepts integers 1-29., it probably could be under 100 lines, but i like to make my code readable. had trouble with the if, else, elseif and a few other small mistakes, but my friend Austin helped me out like the good friend that he is Energy can not be created nor destroyed, just converted to a different Type of energy.My blog: T3Krant.blogspot.com Link to post Share on other sites
Posted June 15, 2013 · Original PosterOP I can make the most useful program in 1 line. Remove all white spaces ^-^. There are 10 types of people in this world, those who can read binary and those who can't. There are 10 types of people in this world, those who can read hexadecimal and F the rest. ~Fletch Link to post Share on other sites
Posted June 15, 2013 Here is a converter that takes any US measurement (like feet or miles) and converts it into inches, feet, yards, and miles and displays them all to the user. Its really useful to do quick and easy conversions. It could easily be adapted to metric also. https://gist.github.com/LernerProductions/5786703 Link to post Share on other sites
Posted June 15, 2013 · Original PosterOP I've updated one of my other programs making it more user friendly. Its the official LTT story maker! Found on this thread: http://linustechtips.com/main/topic/20796-continue-the-story-by-adding-5-words-results/ Source: https://gist.github.com/fletchto99/5786808 There are 10 types of people in this world, those who can read binary and those who can't. There are 10 types of people in this world, those who can read hexadecimal and F the rest. ~Fletch Link to post Share on other sites
Posted June 15, 2013 calculates monthly payment for a loan, given loan amount, APR, and loan term. Source: https://gist.github.com/anonymous/5787834 Link to post Share on other sites
Posted June 15, 2013 Is it allowed to use external libraries? Also, how do you count lines? For instance you can just cramp up all your code on one line if the language uses delimiters such as ;{}()[] Link to post Share on other sites
Posted June 15, 2013 Does a program which says "hi" in the command prompt count as useful? Link to post Share on other sites
Posted June 15, 2013 Stuck for ideas but here's one that converts text to phonetic alphabet https://gist.github.com/joshuabrodie/e1729e56095fff5d922f Link to post Share on other sites
Posted June 15, 2013 The usefulness of this program is very debatable, but here it is: https://gist.github.com/migueldferreira/e634a8c80bb4af5c258b It's a love calculator that gives you a percentage of the love one person feels for another based on their first name! Silly childhood games! Link to post Share on other sites
Posted June 15, 2013 I did this script for opening a random gif. That is my third program or so. Currently only works on OSX, however as you can see there is some stuff for windows, however unfinished. http://pastebin.com/9RGEcAuY SELECT SignatureText FROM Signatures WHERE User = 'UselessBread'; Link to post Share on other sites
Posted June 15, 2013 I had to use a program to launch another program (that I wrote) and that sent commands to it. Since the STDOUT and STDERR were catched in a pipe and used by the host program, I wrote this script to create named pipe to do real time debugging. I just had to have it launched in another console. Then is my program I just had to open the named pipe like a regular file and close it. The code: http://pastebin.com/THNuTDDp This was for Linux, I don't think Windows has named pipes. My dream in life is to live of quality internet fiber and junk food. Link to post Share on other sites
Posted June 15, 2013 This is a program I made in C# that allows a user to either search for 2 files that have the same name but have different extensions OR has a file with the first extension but not with the second one. Very useful when you're working with files that are (to be) converted from one format to another and the directory tree is huge. using System;using System.IO;using System.Linq;namespace matchfinder{ class Program { static void Main(string[] args) { if (args.Length < 3) { Console.WriteLine("Not enough arguments supplied."); return; } else if(!Directory.Exists(args[0])) { Console.WriteLine("Target directory doesn't exist."); return; } int i = 0; if (args.Length == 4 && (args[3] == "and" || args[3] == "not")) { FindMatchingFiles(args[0], args[1], args[2], ref i, args[3]); } else { FindMatchingFiles(args[0], args[1], args[2], ref i); } Console.WriteLine("Found a total of " + i + " matches."); } static void FindMatchingFiles(string basedir, string ext1, string ext2, ref int count, string op = "and") { string[] f; try { f = Directory.GetFiles(basedir); } catch(UnauthorizedAccessException) { Console.WriteLine("Permission denied in " + basedir); return; } foreach (string file in f) { string match = basedir + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(file) + ext2; if (op == "and") { if (Path.GetExtension(file) == ext1 && f.Contains(match)) { Console.WriteLine(String.Format("Found {0} and {1}",Path.GetFullPath(file),Path.GetFullPath(match))); count++; } } else if (op == "not") { if (Path.GetExtension(file) == ext1 && !f.Contains(match)) { Console.WriteLine(String.Format("Found {0} without {1}", Path.GetFullPath(file), Path.GetFullPath(match))); count++; } } } string[] d = Directory.GetDirectories(basedir); foreach (string dir in d) { FindMatchingFiles(dir, ext1, ext2, ref count, op); } } }} Case: CM HAF X NVidia Edition; MoBo: ASUS Sabertooth X58; CPU: Intel Core i7 950@stock (OC will happen later); Cooler: CM Nepton 140XL; RAM: 6x4GB Mushkin Blackline; GPU: MSI GTX 560-Ti Hawk Edition; Primary HDD: Seagate Momentus XT 750GB; OS: Windows 7 Ultimate; Storage: 4x1TB RAID5 (3TB effectively); Link to post Share on other sites
Posted June 15, 2013 here is mine: it is a small, simple paint program. it is written in assembly and it compiles to a 197 byte .com file(runs on dos and win32 and under dos-box on 64 bit windows). you can change the color by using the letter c and then pressing any of the numbers(1-8), you can also change the unit you're drawing whit by pressing r and then the letter you want to draw whit. I also created a version that you can boot into(tested on virtualbox). it compiles to a .bin file and you need to make that .bin file to a .img file by using cmd: copy /b whatever.bin whatever.img, then you can boot using the floppy drive :D herez the codez: .com version: http://pastebin.com/RF1TBuAj(97 lines long) boot version: http://pastebin.com/bmTT8HJS (103 lines long) EDIT: Here's another one I created, it's like the cpu-z Instructions part, but instead of giving you short list like: "MMX,SSE,EM64T,AES jne..", Mine gives you the whole list. it is a 64-bit program , written in c++ and assembly: https://gist.github.com/MRCeRi/62e872efed534af7c74d Might come in handy:D -The guy who you know as CeRi Link to post Share on other sites
Posted June 15, 2013 I call this program: "Delete everything.. EEVERYTHING!!!". I can use dirent.h, right? :) I haven't tested the remove function before, so I'm not sure if this program actually works. But it does a pretty goddamn job at listing the files at least! It will list all the directories and files that are in the working directory (and then continue to those directories recursively). So basically, it doesn't go to the "..\" and ".\" folders, because it just goes infinitely. Here is the code. 51 lines yo! #include "dirent.h"#include <iostream>#include <string>#include <vector>std::string get_working_directory() { static size_t workdir_size = 500; static wchar_t* workdir = new wchar_t [ workdir_size ]; // Yes, here's a memory leak. I was aware of this when I first wrote this function. workdir = _wgetcwd(workdir, workdir_size); std::wstring workdir_wstr = workdir; std::string workdir_str; workdir_str.assign(workdir_wstr.begin(), workdir_wstr.end()); return (workdir_str);}void read_directory(std::string _Directory) { std::vector<std::string> readlater; dirent* ent = NULL; DIR* dir = opendir(_Directory.c_str()); if (dir == NULL) { std::cout << "dir = NULL" << std::endl; return; } while ((ent = readdir(dir))) { switch (ent->d_type) { case (DT_REG): { // remove((_Directory + std::string("\\") + ent->d_name).c_str()); // UNCOMMENT AT OWN RISK - I did not even test this part. I'm too afraid, lol. std::cout << _Directory + "\\" << ent->d_name << std::endl; break; } case (DT_DIR): { if (ent->d_name[0] != '.') { readlater.push_back(_Directory + "\\" + ent->d_name); std::cout << readlater[readlater.size()-1] << std::endl; } break; } } } closedir (dir); for (unsigned int i = 0; i < readlater.size(); i++) { read_directory(readlater[i]); }}int main(int argc, char** argv) { std::string directory = get_working_directory(); read_directory(directory); std::cin.get(); return (0);} What's my prize? B) Link to post Share on other sites