Jump to content

The under 100 line challenge!

fletch to 99

Hey guys, here's a python program that takes a base 10 number ( what we count in) and return it in any base you want. If it's between 2 and 36 it returns a number like 0xFF (255 in hex) and any thing over 36 it returns it as "[2, 45, 3] With a radix of 60" (9903 in base 60;

 



# Takes a number in base 10, and a radix between 2 and 36 and returns the new radix.
def NewRadixNumber(number, newRadix):
    # Change a  to a base-n number.
    # Up to base-36 is supported without special notation.

    num_rep = {10: 'A',  # Dictionary of numbers to change into new radix
               11: 'B',
               12: 'C',
               13: 'D',
               14: 'E',
               15: 'F',
               16: 'G',
               17: 'H',
               18: 'I',
               19: 'J',
               20: 'K',
               21: 'L',
               22: 'M',
               23: 'N',
               24: 'O',
               25: 'P',
               26: 'Q',
               27: 'R',
               28: 'S',
               29: 'T',
               30: 'U',
               31: 'V',
               32: 'W',
               33: 'X',
               34: 'Y',
               35: 'Z'}

    new_num_string = " "  # blank string for new number


    while (number > 0):
        remainder = number % newRadix

        if 36 > remainder > 9:  # if remainder is less than 36 and greater than 9 look through the dictionary
            remainder_string = num_rep[remainder]

        # remainder is equal to or less than 9 so just add that to the number
        else:
            remainder_string = str(remainder)

        new_num_string = remainder_string + new_num_string

        number /= newRadix

    return new_num_string

# Change radix to someting bigger than 36
def SpecialRadix(newNumber,number, newRadix):


    while (number > 0):
        remainder = number % newRadix

        newNumber.append(remainder)  # add the new remainder

        number /= newRadix

def main():
    number = raw_input("Enter a base 10 radix number: ")  # ask for a base 10 number
    newRadix = raw_input("Enter a new Radix: ")  # ask for a new radix

    # change the number and radix into ints
    number = int(number)
    newRadix = int(newRadix)

    if newRadix <= 36:
        print "Converted number is: 0x" + NewRadixNumber(number, newRadix)


    else:
        newNumber = []  # declare an array for the new number

        SpecialRadix(newNumber, number, newRadix)  # pass the array container, number, and new radix into the function

        # Print out the array
        print str(newNumber[::-1]) + " Wtih a radix of " + str(newRadix)  # [::-1] reverses the list/array

    return 0


if __name__ == "__main__":
    main() # makes the program executable 
Link to comment
Share on other sites

Link to post
Share on other sites

Just joined the forums tonight (yay). Stumbled upon this thread and decided to revive a little script I wrote a year ago.

This will convert any Quake 3 or MoH formatted map into a Call of Duty 3/4/5 compatible file. The purpose? Play Quake 3 maps in CoD Zombies on PC :P 

 

Source

 

Also, it's under 50 lines now instead of the 100 target. Considering the original project spanned multiple files before, with many lines - I consider this a success ;D 

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...
On 6/15/2013 at 10:11 AM, Diventurer said:

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)

The enter key is your prize Kappa

TheGrim123321

CPU: I3-4170Cooler: Hyper TX3Mobo:Biostar B85MGMemory: G.Skill Ripjaw 2x4GBStorage: Barracuda 500GBGPU: Zotac GTX660Case: Fractal 1100PSU: Evga 500WMonitors: FHX2153L 21.5"│V193WEJb 19"Keyboard/Mouse: CMStorm DevastorAudio: MonoPrice 8323Microphone: BlueYeti BlackoutOS: MSX(Win10) Quote me or @TheGrim123321 to get my attention.
Link to comment
Share on other sites

Link to post
Share on other sites

My program is very simple, yet very effective. The objective is to see if the computer is in use and turn it off it isn't, to save electricity and money. Obviously could use some buffs in certain areas, but for 35 lines of code I think this is a masterpiece; especially because I just recently began programming. Also for all those programming 'gurus', I am sure this could be better.

using System;
using System.Threading;
using System.Speech.Synthesis;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace _100_line_challenge{
    class Program {
        public static Point MousePosition { get; }
        private static SpeechSynthesizer synth = new SpeechSynthesizer();
        static void Main(string[] args) {     
            while (true) {
                    Point point0 = new Point();
                    Thread.Sleep(6000000);
                    PerformanceCounter perfCpuCount = new PerformanceCounter("Processor Information", "% Processor Time", "_Total");
                    perfCpuCount.NextValue();
                    int currentcpu = (int)perfCpuCount.NextValue();
                    if (currentcpu > 1){
                    Point point1 = new Point();
                    if (point0 == point1) {
                        synth.Speak("Your Computer will shut off in thirty seconds, because of inactivity.");
                        synth.Speak("If you don't want your computer to turn off then press escape.");
                        if(Control.ModifierKeys == Keys.Escape){
                            Thread.Sleep(6000000);
                            continue;
                        }else{
                            Process.Start("shutdown", " /s /30");
                            Thread.Sleep(30000);
                        }
                    }
                }    
                    }
                }
            }   
        }
//Created By Little Bear
//Intellecutal Property
//If you use this as base code:
//please mention me in some way

For the crazy among you here is the compiled program(you can always just compile it yourself if you don't trust me):

Motivation is where, and what you make of it.

 

“It is relatively unusual that a physical scientist is truly an atheist. Why is this true? Some point to the anthropic constraints, the remarkable fine tuning of the universe. For example, Freeman Dyson, a Princeton faculty member, has said, ‘Nature has been kinder to us that we had any right to expect.'”  Albert Einstein

Link to comment
Share on other sites

Link to post
Share on other sites

A reboot benchmark I made, mine is 56 seconds with a 950 Pro!

Make sure to save it as a .VBS and to make sure all file types are checked!

or DOWNLOAD IT HERE:  BootMark.vbs

 

EVERYTHING BELOW OF THIS

 

Option Explicit
On Error Resume Next
Dim Wsh, Time1, Time2, Result, PathFile, MsgResult, MsgA, AppName, KeyA, KeyB, TimeDiff
MsgA = "Please close all running applications and click on OK."
KeyA = "HKEY_CURRENT_USER\Software\RestartTime\"
KeyB = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\RestartTime"
AppName = "Reboot Benchmark"
Set Wsh = CreateObject("WScript.Shell")
PathFile = """" & WScript.ScriptFullName & """"
Result = wsh.RegRead(KeyA & "Times")
if Result = "" then
MsgResult = Msgbox (MsgA, vbOKCancel, AppName)
If MsgResult = vbcancel then WScript.Quit
Wsh.RegWrite KeyA & "Times", left(Time,8), "REG_SZ"
Wsh.RegWrite KeyB, PathFile, "REG_SZ"
Wsh.Run "cmd /c Shutdown -r -t 00", false, 0 
else
Wsh.RegDelete KeyA & "Times"
Wsh.RegDelete KeyA
Wsh.RegDelete KeyB
TimeDiff = DateDiff("s",Result,left(Time,8))
MsgBox "Your computer reboots in " & TimeDiff & " seconds", VbInformation, AppName
end if
wscript.Quit

 

EVERYTHING ABOVE THIS

Link to comment
Share on other sites

Link to post
Share on other sites

Fake BSOD:

Download Here:  BSOD.hta

 

 

Its HTML BTW but to run it in windows desktop you must make it .hta

 

EVERYTHING BELOW THIS

 

<html><head><title>BSOD</title> 
 
<hta:application id="oBVC" 
applicationname="BSOD" 
version="1.0" 
maximizebutton="no" 
minimizebutton="no" 
sysmenu="no" 
Caption="no" 
windowstate="maximize"/> 
 
</head><body bgcolor="#000088" scroll="no"> 
<font face="Lucida Console" size="4" color="#FFFFFF"> 
<p>A problem has been detected and windows has been shutdown to prevent damage to your computer.</p> 
 
<p>If this is the first time you've seen this stop error screen, restart your computer, If this screen appears again, follow these steps:</p> 
 
<p>Check to make sure any new hardware or software is properly installed. If this is a new installation, ask your hardware or software manufacturer for any windows updates you might need.</p> 
 
<p>If problems continue, disable or remove any newly installed hardware or software. Disable BIOS memory options such as caching or shadowing. If you need to use Safe Mode to remove or disable components, restart your computer, press F8 to select Advanced Startup Options, and then select Safe Mode.</p> 
 
<p>Technical information:</p> 
 
 
<p>*** gv3.sys - Address F86B5A89 base at F86B5000, DateStamp 3dd9919eb</p> 
 
<p>Beginning dump of physical memory</p> 
<p>Physical memory dump complete.</p> 
<p>Contact your system administrator or technical support group for further assistance.</p> 
 
 
</font> 
</body></html> 
 

 

EVERYTHING ABOVE THIS

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

Python program to set up a novation launchpad for use with LMMS and other midi-standard DAWs:

 
  import mido
  mido.set_backend('mido.backends.rtmidi')
   
  def mode2(port):
  port.send(mido.parse([0xB0,0x00,0x01]))
   
  def mode1(port):
  port.send(mido.parse([0xB0,0x00,0x02]))
   
   
  print("select midi device:")
  print(mido.get_output_names())
  port = mido.open_output(input(">"))
   
  mode = input("launchpad mode (1 or 2):")
  if mode == "1":
  mode1(port)
  else:
 

mode2(port)

Link to comment
Share on other sites

Link to post
Share on other sites

Hello world in Javascript (seriously, paste it in you're browser's console!)

 

[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+(+(+!+[]+[+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+(!+[]+!+[]+!+[]+[!+[]+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]+!+[]])+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([][[]]+[])[!+[]+!+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()

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 comment
Share on other sites

Link to post
Share on other sites

On 19.7.2016 at 9:41 PM, fletch to 99 said:

Hello world in Javascript (seriously, paste it in you're browser's console!)

 


[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+(+(+!+[]+[+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+(!+[]+!+[]+!+[]+[!+[]+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]+!+[]])+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([][[]]+[])[!+[]+!+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()

 

I thought the rule was to have a useful program that can be used. If this is not valid anymore, I could write you some Hello World one-liners in quite some languages.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

one liner that git clones a file and installs it :^)

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

  • 3 weeks later...

Heres some python 3.5 from a good while back, another post reminded me I had it. Its sloppy and abit hacky since when I made it I was just trying to get it to work quickly. Its just a cipher that makes a key file and a file for the encrypted message. It does require inflect to convert numbers to their word form, which was easier than handling numbers and letters/symbols.

 

Spoiler

		

		

#import modules, inclect will likely need to be installed
import re, inflect, ast, os
from random import SystemRandom
#a few constants
cryptogen = SystemRandom()
infl = inflect.engine()
alpha = {'a': 1, 'c': 3, 'b': 2, 'e': 5, 'd': 4, 'g': 7, 'f': 6, 'i': 9, 'h': 8, 'k': 11, 'j': 10, 'm': 13, 'l': 12, 'o': 15, 'n': 14, 'q': 17, 'p': 16, 's': 19, 'r': 18, 'u': 21, 't': 20, 'w': 23, 'v': 22, 'y': 25, 'x': 24, 'z': 26,' ':27,'.':28,'-':29,'?':29,'!':30,'&':31,'$':32,',':33}
beta = {1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e', 6: 'f', 7: 'g', 8: 'h', 9: 'i', 10: 'j', 11: 'k', 12: 'l', 13: 'm', 14: 'n', 15: 'o', 16: 'p', 17: 'q', 18: 'r', 19: 's', 20: 't', 21: 'u', 22: 'v', 23: 'w', 24: 'x', 25: 'y', 26: 'z', 27: ' ', 28: '.',29:'-',29:'?',30:'!',31:'&',32:'$',33:','}

def decryption(encrypted, keys):
    decrypted = encrypted
    for chara in range(len(encrypted)):
        decrypted[chara] = (beta[((encrypted[chara] + keys[chara] - 1125) / keys[chara])])

    readable = "".join(decrypted)
    print(readable)

def encryption(message,name):
    numbered = []
    message = re.sub(r'[^\w ?,&!-$.]', ' ', message)

    for symbol in message:
        if symbol.isdigit():
            word = infl.number_to_words(int(symbol))
            message = message.replace(symbol,word)
    key = cryptogen.randrange(1000,999999999999999)

    for letter in message:
        numbered.append(alpha[letter])
    crypted = numbered
    encrypted = numbered
    keys = numbered
    keys = [cryptogen.randrange(10000000,99999999999999) for i in range(len(numbered))]
    for chara in range(len(crypted)):
        encrypted[chara] = ((numbered[chara] * keys[chara]) + 1125 - keys[chara])
    text_file = open(name+"_message.txt", "w")
    key_file = open(name+"_keys.txt", "w")
    text_file.write(str(encrypted))
    key_file.write(str(keys))
    text_file.close()
    key_file.close()
    print('Encryption Complete')
while True:
    mode = str(input('encrypt or decrypt?' )).lower()

    if 'en' in mode:
        name = str(input('Enter title for message:' )).lower()
        message = str(input('Enter your message:' )).lower()
        encryption(message,name)
    if 'de' in mode:
        name = str(input('Enter file title:' )).lower()
        try:
            keyfile = open(name+'_keys.txt',"r")
            messagefile = open(name+'_message.txt',"r")
        except:
            print('No Such File')
            continue
        encrypted = ast.literal_eval(messagefile.read())
        keys = ast.literal_eval(keyfile.read())
        decryption(encrypted, keys)
        messagefile.close()
        keyfile.close()
        print('#END OF MESSAGE#')
        keep = str(input('Would you like to delete the files? ')).lower()
        if 'y' in keep:
            os.remove(name+'_keys.txt')
            os.remove(name+'_message.txt')
    else:
        continue

[ /code]

Nothing truly useful, but eh 

                     .
                   _/ V\
                  / /  /
                <<    |
                ,/    ]
              ,/      ]
            ,/        |
           /    \  \ /
          /      | | |
    ______|   __/_/| |
   /_______\______}\__}  

Spoiler

[i7-7700k@5Ghz | MSI Z270 M7 | 16GB 3000 GEIL EVOX | STRIX ROG 1060 OC 6G | EVGA G2 650W | ROSEWILL B2 SPIRIT | SANDISK 256GB M2 | 4x 1TB Seagate Barracudas RAID 10 ]

[i3-4360 | mini-itx potato | 4gb DDR3-1600 | 8tb wd red | 250gb seagate| Debian 9 ]

[Dell Inspiron 15 5567] 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

40 minutes ago, RedWulf said:

--snip--

input() already returns a string, no need for all the str()s

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

48 minutes ago, fizzlesticks said:

input() already returns a string, no need for all the str()s

Thanks,

At some point I had hit some syntax error with doing the lower case operation on one of the inputs, I think it may have been related to the string though, I just went overly cautious. I'm cleaning it up now actually. 

                     .
                   _/ V\
                  / /  /
                <<    |
                ,/    ]
              ,/      ]
            ,/        |
           /    \  \ /
          /      | | |
    ______|   __/_/| |
   /_______\______}\__}  

Spoiler

[i7-7700k@5Ghz | MSI Z270 M7 | 16GB 3000 GEIL EVOX | STRIX ROG 1060 OC 6G | EVGA G2 650W | ROSEWILL B2 SPIRIT | SANDISK 256GB M2 | 4x 1TB Seagate Barracudas RAID 10 ]

[i3-4360 | mini-itx potato | 4gb DDR3-1600 | 8tb wd red | 250gb seagate| Debian 9 ]

[Dell Inspiron 15 5567] 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

This is a small C# console app that can download any public Instagram photo (optionally with caption) without the Instagram API. Probably could be made shorter, but ehhhh.

cat-a-gram BJSzqWBhppW a

downloads this image as BJSzqWBhppW.jpg

using System;
using System.Net;
using System.Text.RegularExpressions;
using System.Globalization;

namespace Cat_A_Gram
{
    class Program
    {
        static void Main(string[] args)
        {
            string imageAddress = args[0];
            string completePageURL = "https://www.instagram.com/p/" + imageAddress + "/";

            //Downloading the page's source code
            WebClient webClient = new WebClient();

            try
            {
                //Point-Of-Connection to the internet here
                string htmlCode = webClient.DownloadString(completePageURL); //This can crash -- 404 WebException if it can't find a page.

                //Getting image path and cleaning it up... There is a better way sure, but it works.
                string imageHtmlCode = htmlCode.Substring(htmlCode.IndexOf("\"display_src\""), htmlCode.IndexOf("location") - htmlCode.IndexOf("display_src"));
                string cleanImageURL = imageHtmlCode.Substring(imageHtmlCode.IndexOf("http"), imageHtmlCode.IndexOf("?") - imageHtmlCode.IndexOf("http"));

                //Same thing, getting the image's caption
                string captionHtmlCode = htmlCode.Substring(htmlCode.IndexOf("\"caption\""), htmlCode.IndexOf("\"likes\"") - htmlCode.IndexOf("\"caption\""));
                string cleanCaptionText = captionHtmlCode.Substring(captionHtmlCode.IndexOf(":") + 3).Substring(0, captionHtmlCode.Substring(captionHtmlCode.IndexOf(":") + 3).Length - 3);

                string imageFilePath;

                if (args.Length == 2)
                {
                    switch (args[1])
                    {
                        case "a":
                        case "address":
                            imageFilePath = imageAddress + ".jpg";
                            //Point-Of-Connection to the internet here
                            webClient.DownloadFile(cleanImageURL, imageFilePath); //These shouldn't throw 404s because there must be an image.
                            break;
                        case "c":
                        case "caption":
                            imageFilePath = cleanCaptionText + ".jpg";
                            //Point-Of-Connection to the internet here
                            webClient.DownloadFile(cleanImageURL, DecodeEncodedNonAsciiCharacters(imageFilePath)); //These shouldn't throw 404s because there must be an image.
                            break;
                        default:
                            Console.WriteLine("\nUSER ERROR: " + args[1] + " is not recognized as a valid [name] argument. Type \"cat-a-gram help\" for a list of arguments.");
                            break;
                    }
                }
                else
                {
                    imageFilePath = imageAddress + ".jpg";
                    //Point-Of-Connection to the internet here
                    webClient.DownloadFile(cleanImageURL, imageFilePath); //These shouldn't throw 404s because there must be an image.
                    Console.WriteLine("  File downloaded to " + imageFilePath);
                }
            }
            catch (WebException)
            {
                //Possibly 404 caught
                Console.WriteLine("NETWORK ERROR: No Instagram page under " + completePageURL + " is not found.");
            }
        }

        //Thanks to Adam Sills from stackoverflow for this function. Makes emojis work as filenames.
        static string DecodeEncodedNonAsciiCharacters(string value)
        {
            return Regex.Replace(
                value,
                @"\\u(?<Value>[a-zA-Z0-9]{4})",
                m => {
                    return ((char)int.Parse(m.Groups["Value"].Value, NumberStyles.HexNumber)).ToString();
                });
        }
    }
}

 

Link to comment
Share on other sites

Link to post
Share on other sites

Simple, small script in Python3 to fetch your external IP, because reasons. (Like wanting to check if your proxy is working :P)

#!/usr/bin/python3
import requests;

url = "https://api.ipify.org";
req = requests.get(url);
print("Your External IP is: "+req.text);

 

Link to comment
Share on other sites

Link to post
Share on other sites

How about under 20 lines?

My program calculates PI in Lua.

http://pastebin.com/e2BvQfNu

 

done = false
-- The algorithm will be ran 1/2 of the amount variable.
amount = 1000
x = 3
numpi = 1
while x < amount do
numpi = numpi - 1/x
x = x + 2
numpi = numpi + 1/x
x = x + 2
print(numpi * 4)
end
if x > amount and done == false then
numpi = numpi * 4
print(numpi)
print("Depending on how big the 'amount' variable is, is how accurate PI is")
done = true
end
stop = io.read()

 

If you're curious about the math behind this:

 

1/1 - 1/3 + 1/5 - 1/7 ... for an infinite amount of odd denominators. Then multiply by 4 and BOOM, your got Pi :)

 

1/1 - 1/3 + 1/5 - 1/7 ... * 4 =  π

Take life with a slice of PI.

                                                                
                                           `````````````````````                                           
                                ``````````` ````............``` ````````````                               
                          .```````.,,,``.,,,,,,...:::..``...,,,,,,.``.:,.`````````                         
                     ````` .:,`,:,```````````.::::::::::,````````````````,:,`.:. ``````                    
                 ``````,.,,.`````````````,`::::::::::'++#      ````````````````.,.`,. `````                
              `````,.,.````````````  `.,::::::::::::';++#                ```````````.,`,`````.             
           .````,.,````````````     ,:::::::::;;:;:::::,;.                ::. ``````````,...````.          
        ```` :..```````````    .,:::::::::#'++####++::::::::::.```        #::::. ``````````..,`````        
      `````,,```````````      :::::::::::::::;+++####++;;:::::::::::,,,,,;:::::::   ``````````,`.````      
     ````:,```````````       :::::;;+;+:::::::::::#+##+#+++#'';::::::::::::::::::,    ``````````,.`````    
    `````.```````````      `.;::::+++++++++:;:::::::::'#####+#+++'':;::::::::;'+++      `````````,`:````   
   ````````````````      `...;;;:::++++++++++++;:::::::::;;+#+###+#+##+###++#+#+#+``     ```````````:````  
  `````:```````````    `...``;;;;;;++++++++++++++++::::::::::'++###+##+######+#+++``.     `````````:`.```` 
  ```:````````````    `...```;;;;;;++++++++++++++++++:::::::::::++++######+##+#++#```.    ```````````.```` 
 .```.````````````    ....```;;;;;;++++++++++++++++++++''::;::::+########++##+####````.   ```````````````` 
 .` `.````````````    ...````;;;;;;'++++++++++++++++++++++++++++++##+#+######+#+++````.   ```````````````` 
  ` `:`:```````````   ...````;;;;;;'++++++++++++++++++++++++++++++#+##+#+##+#+###:````.   `````````:`.` `` 
  `` ```.```````````` ....`````;;;;:::::::;'+++++++++++++++++++++:;+++##+##+###':````.   `````````.``. ``` 
   `` ```,````````.``, `...``````;;````.,::::::++++++++++++++++++`.,::::::::::::````.  ``````````:``: ```  
    `` ```.````````.``., ...`````````.,`````.::::;+++++++++++++++``````````````````` ```````````.``, ```   
     ``` :``.````.```.``:,`...`````````:+:``````,:::;++++++++++++.``++++:````````` ```````````.``. ```.    
      ```  ,```,``..``:,`.::` ...``````',#+````````.:::'++++++++:`````;;``````` ```````````,```.` ````     
        ```` :````:`:.`.:,`,::.````..``````````````````:::;;;;+;``````````` ````````````:````, ````        
           ```  : .``::.`:::`.::,.``````..````````````````.,:,``````````````````````:.````,` ```.          
             ````` :. `::.,:::,.:::,,..````````````````````````````````````````,,``````,` `````            
                ````.:.,:::..,:::.,:::::::.`````````````````````````````.,,.````` .,` `````                
                    ``::.`::::.,::::::::::,.,,,,,,,,,,,,,,,,,::,.`````````` `,,` ``````                    
                        ::,.,:::::::::::::,:::::,...,.``````````   `.,,,`  ``````.`                        
                         `:::,,:::::::::. `.,::::::::::,....``   ````````````                              
                           `;:::::::::,   `...```.,;:::::::::::,..,,`                                      
                              :::::::                  ,;::::::::::::,,...,:,.                             
                                `,,`                       `:::::::::::::::::,,:`                          
                                                               `::::::::::::::::                           
                                                                   `;::::::::::                            
                                                                       :::::::.                            
                                                                          ,:                               
                                                                           
Link to comment
Share on other sites

Link to post
Share on other sites

I will have to find it and count the lines, but somewhere I have a program I called Einstein in Python. It took basic commands like "Calculator" or "Translator" or "List" and opened the corresponding piece of code. It was super advanced for an 11 or 12 year old who had just started learning Python. I think it translated english to pig latin and vice versa... The calculator did basic calculator things. And I think I started with a type to explore dungeon crawler type thing text explorer. (I think that is how I could best describe it.) If I find it I will edit it in here.

ERROR: VAR_TRAINOFTHOUGHT RETURN CHAR(MISSING)

RESTART  BRAINTHOUGHTS_MAJORGOOB.EXE?

 

Y                             N

~               

Link to comment
Share on other sites

Link to post
Share on other sites

Simple script to put a window (any window) on certain transparency, on top of all other and click through.
This is a little tool i did because when I'm coding I love to be watching movies or series and usually use a secondary monitor for this but I had an accident and for a time I had only one so I did this.

Once started the mouse will have a tooltip ^ any window you click on will become the target. To remove the status just hit F7 (by default you can edit this at line 75)
sample

 Run it using AHK

 

#Persistent
OnExit, END

;#####################################################################################
; OPTIMIZATIONS
;#####################################################################################
;http://ahkscript.org/boards/viewtopic.php?f=6&t=6413
#NoEnv
Process, Priority, , H
SetBatchLines, -1
ListLines Off
#KeyHistory 0
SendMode Input
SetTitleMatchMode 2
SetTitleMatchMode Fast
SetKeyDelay, -1, -1, Play
SetMouseDelay, -1
SetWinDelay, 0

START:
DetectHiddenWindows, On
InputBox, opacity, Opacity Level, Opacity for the window (25-255)., , 250, 125, , , , ,220
if ErrorLevel {
	MsgBox, , Click Through, App will terminate.
	Goto, END
}
    
else {
	if opacity < 26
		opacity = 25
	if opacity > 254
		opacity = 255
}


Loop {
	MouseGetPos,,,vindu,control
	WinGet,vindustatus,ExStyle,ahk_id %vindu%
	Transform,resultat,BitAnd,%vindustatus%,0x8
		
	If resultat <> 0
		ToolTip,^
	Else
		ToolTip,_
	Sleep,50
	
	KeyWait, LButton, D T0.02
	If not ErrorLevel
	{
		MouseGetPos,,,vindu,control
		If resultat = 0
		{
			WinSet,AlwaysOnTop,On,ahk_id %vindu%
			WinActivate,ahk_id %vindu%
			WinSet,Transparent,%opacity%,ahk_id %vindu%
			WinSet,ExStyle,+0x20,ahk_id %vindu%
			ToolTip,^
			Sleep,250
			ToolTip,
			Break
		}
		Else
		{	
			WinSet, Transparent, Off,ahk_id %vindu%
			WinSet, ExStyle, -0x20,ahk_id %vindu%
			ToolTip,_
			Sleep,250 
			WinMinimize,ahk_id %vindu%
			Break
		}
	}
}

Loop {
	KeyWait, f7, D T0.02 	;set your prefeared key to terminate
	If not ErrorLevel
		{   
			ExitApp
		}
	KeyWait, F6, D T0.02 	;set your prefeared key to reload
	If not ErrorLevel
		{   
			ToolTip,
			WinSet,AlwaysOnTop,Off,ahk_id %vindu%
			WinSet, Transparent, off,ahk_id %vindu%
			WinSet, ExStyle, -0x20,ahk_id %vindu%
			Goto, START
		}
	}

END:
If resultat = 0 
{
	ToolTip,
	WinSet,AlwaysOnTop,Off,ahk_id %vindu%
	WinSet, Transparent, off,ahk_id %vindu%
	WinSet, ExStyle, -0x20,ahk_id %vindu%
	MsgBox, ,Click Through, Thank you...  Bye!
}
ExitApp

 

Link to comment
Share on other sites

Link to post
Share on other sites

  • 3 weeks later...

So this is my calculator, it has Addition, Subtraction, Multipication, Divition and it can calculate the Quadratic formula for you!

Its just on the line(hehe)- 97 of them. (Its in java)

import java.util.Scanner;
public class Calc
{

	
	public static void main(String[] args)
	{
	Scanner UserIn=new Scanner(System.in);
	
	
	System.out.println("Choose your Operation ");
	System.out.println("1. Addition ");
	System.out.println("2. Subtraction ");
	System.out.println("3. Multipication ");
	System.out.println("4. Division ");
	System.out.println("5. Quadratic Formula ");
	int UserOper=UserIn.nextInt();
	if(UserOper==1){
		System.out.println("Choose two numbers(Must be integers) ");
		int Num1= UserIn.nextInt();
		int Num2=UserIn.nextInt();
		int Answer=AddNum(Num1, Num2);
		System.out.println(Answer);
	}
	else if(UserOper==2){
	System.out.println("Choose two numbers(Must be integers) ");
	int Num1= UserIn.nextInt();
	int Num2=UserIn.nextInt();
		int Answer=Subtraction(Num1, Num2);
		System.out.println(Answer);
	}
	else if(UserOper==3){
		System.out.println("Choose two numbers(Must be integers) ");
		int Num1= UserIn.nextInt();
		int Num2=UserIn.nextInt();
		int Answer=Multipication(Num1, Num2);
		System.out.println(Answer);
	}
	else if(UserOper==4){
		System.out.println("Choose two numbers ");
		double Num1= UserIn.nextInt();
		double Num2=UserIn.nextInt();
		double Answer=DivideNum(Num1, Num2);
		System.out.println(Answer);
	}
	else if(UserOper==5){
		System.out.println("A: ");
		double UserA=UserIn.nextDouble();
		System.out.println("B: ");
		double UserB=UserIn.nextDouble();
		System.out.println("C: ");
		double UserC=UserIn.nextDouble();
		if(Math.pow(UserB, 2)+(-4*UserA*UserC)<0){
			System.out.println("There is no answer to these numbers ");
		}
		else{
			double Answer1=QuadraticFormula1(UserA, UserB, UserC);
			double Answer2=QuadraticFormula2(UserA, UserB, UserC);
			System.out.println("The answers are "+Answer1+ ", "+Answer2);
		}
	}
	else{
		System.out.println("Invalid operation");
	}
	
			
			
		}
	public static int AddNum(int a, int b){
		int Answer=a+b;
		return Answer;
		
	}
	public static int Subtraction(int a, int b){
		int Answer=a-b;
		return Answer;
	}
	
	public static int Multipication(int a, int b){
		int Answer=a*b;
		return Answer;
	}
	public static double DivideNum(double a, double b){
		double Answer=a/b;
		return Answer;
	}
	public static double QuadraticFormula1(double a, double b, double c){
		double b2=Math.pow(b, 2);
		double Result1=(-b+Math.sqrt(b2-(4*a*c)))/(2*a);
		
		return Result1;
	}
	public static double QuadraticFormula2(double a, double b, double c){
		double b2=Math.pow(b, 2);
		double Result2=(-b-Math.sqrt(b2-(4*a*c)))/(2*a);
		return Result2;
	}
	}

 

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

Was getting bored in my intro to programming class today. I am also feeling kinda funny today, so I wrote a funny program with Python 3

The goal of this program is to attempt to sort a list by randomly shuffling the list and then checking to see if it's sorted. May luck be on your side if you are attempting to sort a list with more than 5 items in it.

This is by far the most uselessly useful thing I've ever written.

 

import random
import time

# shuffle the list
def stooge_shuffle(unsorted_list):

    random.shuffle(unsorted_list)
    return unsorted_list

# check if a list is sorted
def check_sort(my_list):
    for i in range(0, len(my_list) - 1):
        if my_list[i + 1] >= my_list[i]:
            continue
        else:
            return False

    return True

# The main logic for stooge sort. Shuffles the list, then checks to see if the list is sorted
def stooge_sort(my_list):

    if check_sort(my_list):
        return my_list

    else:
        while True:
            my_list = stooge_shuffle(my_list)

            if check_sort(my_list):
                return my_list

            else:
                continue

# Makes sure that the user only entered an integer
def get_input():

    while True:
        try:
            user_input = int(input("Please enter an integer then press enter: "))
            break

        except:
            print("You did not enter an integer.")

    return user_input

# Is the main method for the fun
def main():
    users_list = [i for i in range(0, get_input())]
    print("Your list is: {a}" .format(a=users_list))

    random.shuffle(users_list)
    print("The list that will be sorted is: {a}" .format(a=users_list))

    start = time.time()
    print("The sorted list is: {a}" .format(a=stooge_sort(users_list)))
    end = time.time()
    print("It took {a} seconds to sort the list." .format(a=end-start))

# Call the main method
main()

 

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×