|
Doc's Scripts
|
|
Topic Started: Jun 16 2015, 12:55 AM (250 Views)
|
|
Doc
|
Jun 16 2015, 12:55 AM
Post #1
|
- Posts:
- 3,700
- Group:
- Skin Admin
- Member
- #79
- Joined:
- June 28, 2010
|
I guess this is 'Development', in a way. Anywho, I write scripts and stuff. Studying java atm, and wrote this script to find the "numerical value" of your name. If you don't know how to run scripts in terminal/CMD, well, look it up I suppose~
Pastebin: http://pastebin.com/Gp47H35v
Code:
Spoiler: click to toggle - Code:
-
import java.util.*; import javax.swing.*; import java.awt.*;
public class alphaname{ private static final long serialVersionUID = 1; private static Scanner sc = new Scanner(System.in); public static void main(String[] args){ scan(); } public static void scan(){ System.out.println("Type your name: "); String name = sc.nextLine(); alphabatize(name); } public static void alphabatize(String name){ int[] numericals = new int[26]; int total = 0; for(int i = 0;i < numericals.length;i++){ numericals[i] = i + 1; } char[] lowercase = {'a','b','c','d','e','f','g','h','i','j','k','l','m', 'n','o','p','q','r','s','t','u','v','w','x','y','z'}; char[] uppercase = {'A','B','C','D','E','F','G','H','I','J','K','L','M', 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; for(int i = 0;i<name.length();i++){ char c = name.charAt(i); boolean process = true; for(int j = 0;j < 26;j++){ if(lowercase[j] == c || uppercase[j] == c && !process){ total += numericals[j]; process = false; } } } System.out.println("The numerical value of your name is: " + total); } }
If you want to request a script to be made in a certain language (for anything mathematical/scientific), hmu on the task.
- Attached to this post:
alphaName.class (1.71 KB)
|
|
|
| |
|
Doc
|
Jun 18 2015, 03:39 AM
Post #2
|
- Posts:
- 3,700
- Group:
- Skin Admin
- Member
- #79
- Joined:
- June 28, 2010
|
Here's another script; it creates a random password/key with a prompted length. Pretty simple.
Pastebin: http://pastebin.com/TpnpWfCx
Code:
Spoiler: click to toggle - Code:
-
import java.io.*; import java.util.Scanner; import java.util.Random; public class passwordgenerator{ private static Scanner sc = new Scanner(System.in); public static void main(String... args) throws IOException{ passOperate(passIn()); } public static int passIn(){ System.out.println("How long should the password be?"); int length = sc.nextInt(); String cr = sc.nextLine(); return length;} public static void passOperate(int l){ String[] c = new String[l]; Random r = new Random(); String alphabet = "qwertyuiopasdfghjklzxcvbnm"; for(int i = 0; i < l; i++){ int ran = (int) (Math.random()*10) + 1; if(ran >= 6) c[i] = "" + alphabet.charAt(r.nextInt( alphabet.length())); if(ran <= 5) c[i] = "" + ((int) (Math.random()*9)+1); } for(int i = 0; i<c.length;i++){ if(c[i] != null || c[i] != " ") System.out.print(c[i]);} System.out.println(); runAgain(); } public static void runAgain(){ System.out.println("Run again? [y/n]"); String s = sc.nextLine(); char c = s.charAt(0); switch(c){ case('y'): passOperate(passIn()); break; case('n'): System.exit(0); break; } } }
|
|
|
| |
|
Doc
|
Jun 24 2015, 09:36 PM
Post #3
|
- Posts:
- 3,700
- Group:
- Skin Admin
- Member
- #79
- Joined:
- June 28, 2010
|
A little "lotto" gambling type script.
Pastebin: http://pastebin.com/L6pLJYtg
code:
Spoiler: click to toggle - Code:
-
import java.io.*; import java.util.*; public class lottorun { private static Scanner sc = new Scanner(System.in); private static int hasran = 0; private static int hasasked = 0; public static void main(String... args) throws IOException {prompt();} protected static void prompt(){ if(hasran == 0) System.out.println("Lottoscript is running. Type 'spin' to test your luck."); String cmd = sc.nextLine(); switch(cmd){ case("spin"): case("Spin"): case("roll"):roll(); break; default: System.out.println("Unknown Command."); hasran++; prompt(); break;} } public static void roll(){ int spins = 3; String[] rolls = {"*","@","%","&","$"}; String[] luck = new String[3]; int j = 0; while(j < (spins*4) + 1){ System.out.print("-");j++;}j=0; System.out.println(); for(int i = 0; i < spins; i++){ int ran = (int) (Math.random()*(rolls.length - 1)); luck[i] = rolls[ran]; System.out.print(rolls[ran] + " "); if(i == spins - 1) System.out.println();} while(j < (spins*4) + 1){ System.out.print("-");j++;}j=0; System.out.println(); if(luck[0] == luck[1] && luck[1] == luck[2] && luck[2] == luck[0]) System.out.println("\nYou won!"); else System.out.println("Better luck next time!"); spinAgain(); } public static void spinAgain(){ if(hasasked == 0) System.out.println("Spin again? (y/n)"); String cmd = sc.nextLine(); switch(cmd) { case("y"): case("yes"):roll(); hasran = 0; break; case("n"): case("no"):System.exit(0); break; default:System.out.println("Unknown Command."); hasasked++; spinAgain(); break; } }
}
|
|
|
| |
|
Doc
|
Jul 13 2015, 09:30 PM
Post #4
|
- Posts:
- 3,700
- Group:
- Skin Admin
- Member
- #79
- Joined:
- June 28, 2010
|
Avery, you beginner-level swine
Pastebin: http://pastebin.com/jBB2tR6y
Code:
Spoiler: click to toggle - Code:
-
//for Avery. Here's the code you wrote; that I RE-wrote in like a minute. You pig. import java.util.Scanner; public class drinkingage{ private static Scanner sc = new Scanner(System.in); public static void main(String... args){ scan(); } public static void scan(){ System.out.println("How old are you?"); String age = sc.nextLine(); decide(Integer.parseInt(age)); } public static void decide(int age){ if(age>=21) System.out.println("You can drink! Cheers!"); else System.out.println("Sorry, you cannot drink. " + (21 - age) + " more years!"); System.exit(0); } }
|
|
|
| |
|
Doc
|
Aug 14 2015, 09:32 PM
Post #5
|
- Posts:
- 3,700
- Group:
- Skin Admin
- Member
- #79
- Joined:
- June 28, 2010
|
Scripted a little start-up HTML file for my browser in ArchL
Pastebin: http://pastebin.com/RmRwUQLC
Code:
Spoiler: click to toggle - Code:
-
<!DOCTYPE html> <html lang="en-US"> <html> <head> <title> (uvu)/ Welcome~ </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <center> <p> <font face="Courier New" font size= 14>ようこそジョセフ!</font> </p> <img src="http://i.imgur.com/c1lIhSD.gif" alt="Background GIF" style="width:500px;height:250px:"> <!-- 4CHAN --> <p> <p> <a href="http://www.4chan.org/"> <font face="Monospace" font size= 4><b>4CHAN:</b></font></a> <img src="http://i.imgur.com/5cXmqSj.png" alt="4chan.png" style="width:10px;height:15px:"></p> <a href="http://www.4chan.org/g/"> <font face="Courier New" font size= 2>/g/</font></a>, <a href="http://www.4chan.org/co/"> <font face="Courier New" font size= 2>/co/</font></a>, <a href="http://www.4chan.org/v/"> <font face="Courier New" font size= 2>/v/</font></a>, <a href="http://www.4chan.org/vg/"> <font face="Courier New" font size= 2>/vg/</font></a>, <a href="http://www.4chan.org/b/"> <font face="Courier New" font size= 2>/b/</font></a> </p> <!-- REDDIT --> <p> <p> <a href="http://www.reddit.com/"> <font face="Monospace" font size= 4><b>REDDIT:</b></font></a> <img src="http://i.imgur.com/97iUOsy.png" alt="Reddit.png" style="width:10px;height:15px:"></p> <a href="https://www.reddit.com/r/videos/"> <font face="Courier New" font size= 2>r/videos</font></a>, <a href="https://www.reddit.com/r/WTF/"> <font face="Courier New" font size= 2>r/wtf</font></a>, <a href="https://www.reddit.com/r/trees/"> <font face="Courier New" font size= 2>r/trees</font></a>, <a href="https://www.reddit.com/r/4chan/"> <font face="Courier New" font size= 2>r/4chan</font></a>, <a href="https://www.reddit.com/r/me_irl/"> <font face="Courier New" font size= 2>r/me_irl</font></a> </p> <!-- OTHER --> <p> <a href="http://www.facebook.com/"><font face="Monospace" font size= 4><b>FACEBOOK</b></font></a>, <a href="http://www.twitter.com/"><font face="Monospace" font size= 4><b>TWITTER</b></font></a>, <a href="http://www.youtube.com/"><font face="Monospace" font size= 4><b>YOUTUBE</b></font></a>, <a href="http://www.tumblr.com"><font face="Monospace" font size= 4><b>TUMBLR</b></font></a> </p> <p> <a href="http://forums.theminusworld.net/index.php"><font face="Monospace" font size= 4><b>MINUSW</b></font></a>, <a href="http://s15.zetaboards.com/TCOTL/index/"><font face="Monospace" font size= 4><b>TCOTL</b></font></a>, <a href="http://forums.mfgg.net/"><font face="Monospace" font size= 4><b>MFGG</b></font></a>, <a href="http://www.newgrounds.com/"><font face="Monospace" font size= 4><b>NEWGROUNDS</b></font></a> </p> </center> </body> </html>
|
|
|
| |
|
Doc
|
Aug 16 2015, 05:49 AM
Post #6
|
- Posts:
- 3,700
- Group:
- Skin Admin
- Member
- #79
- Joined:
- June 28, 2010
|
This one looks a little better; Orange highlights with a dark background. Fits my desktop~
pastebin:
http://pastebin.com/f2T3UWyd
Screenshot (!!!Large Image):
Spoiler: click to toggle
|
|
|
| |
|
thunder bro
|
Aug 16 2015, 03:02 PM
Post #7
|
- Posts:
- 826
- Group:
- Special
- Member
- #4
- Joined:
- February 6, 2008
|
eww Kirino
|
|
| |
|
Doc
|
Aug 16 2015, 05:15 PM
Post #8
|
- Posts:
- 3,700
- Group:
- Skin Admin
- Member
- #79
- Joined:
- June 28, 2010
|
- thunder bro
- Aug 16 2015, 03:02 PM
eww Kirino wow pls leave
|
|
|
| |
|
thunder bro
|
Aug 16 2015, 11:50 PM
Post #9
|
- Posts:
- 826
- Group:
- Special
- Member
- #4
- Joined:
- February 6, 2008
|
On another note, nice startup page.
|
|
| |
|
Dangus
|
Aug 17 2015, 01:26 AM
Post #10
|
- Posts:
- 1,018
- Group:
- Special
- Member
- #66
- Joined:
- March 13, 2010
|
ur not a real coder til u can code php get on my lvl b
|
My OC
Also, my blog
|
| |
|
Doc
|
Aug 19 2015, 01:04 AM
Post #11
|
- Posts:
- 3,700
- Group:
- Skin Admin
- Member
- #79
- Joined:
- June 28, 2010
|
p h p = p o o p
|
|
|
| |
| 1 user reading this topic (1 Guest and 0 Anonymous)
|