This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.math.BigInteger; | |
| import java.security.MessageDigest; | |
| import java.security.NoSuchAlgorithmException; | |
| public class JavaHasher { | |
| private static final String HASH_ALGO = "SHA512"; | |
| public String hashInput(String input) { | |
| String hashed = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.File; | |
| import java.lang.management.ManagementFactory; | |
| import java.text.DateFormat; | |
| import java.text.SimpleDateFormat; | |
| import java.util.Date; | |
| import javax.management.InstanceNotFoundException; | |
| import javax.management.MBeanException; | |
| import javax.management.MBeanServer; | |
| import javax.management.MalformedObjectNameException; | |
| import javax.management.ObjectName; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.File; | |
| import java.lang.management.ManagementFactory; | |
| import java.text.DateFormat; | |
| import java.text.SimpleDateFormat; | |
| import java.util.Date; | |
| import javax.management.InstanceNotFoundException; | |
| import javax.management.MBeanException; | |
| import javax.management.MBeanServer; | |
| import javax.management.MalformedObjectNameException; | |
| import javax.management.ObjectName; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.github.games647.JarUtils; | |
| import com.sun.tools.attach.VirtualMachine; | |
| import java.lang.management.ManagementFactory; | |
| public class AgentLoadingRuntime { | |
| public static void loadAgent(String[] args) { | |
| String nameOfRunningVM = ManagementFactory.getRuntimeMXBean().getName(); | |
| int p = nameOfRunningVM.indexOf('@'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <settings> | |
| <!-- localRepository | |
| | The path to the local repository maven will use to store artifacts. | |
| | | |
| | Default: ~/.m2/repository | |
| --> | |
| <localRepository>/path/to/local/repo</localRepository> | |
| </settings> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; round-half-up: number -> integer | |
| ;; | |
| ;; Rounds the number to the nearest neighbor | |
| ;; | |
| ;; Example: (round-half-up 2.5) = 3 | |
| (define (round-half-up number) (floor (+ number .5))) | |
| ;; Tests | |
| (check-expect (round-half-up 2.5) 3) | |
| (check-expect (round-half-up 3) 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; The first three lines of this file were inserted by DrRacket. They record metadata | |
| ;; about the language level of this file in a form that our tools can easily process. | |
| #reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname newton-method) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f))) | |
| ;; length-representation: number number -> number | |
| ;; | |
| ;; Outputs the lowester exponent for b which is higher than x | |
| ;; | |
| ;; Example: (length-representation 10 2) = 4 | |
| (define (length-representation x b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; The first three lines of this file were inserted by DrRacket. They record metadata | |
| ;; about the language level of this file in a form that our tools can easily process. | |
| #reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname newton-method) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f))) | |
| ;; newton-method: (X -> Y) (X -> Z) number number -> number | |
| ;; | |
| ;; Makes use of the newton method to calculate the f(x) = 0 | |
| ;; | |
| ;; Example: | |
| (define (newton-method fct fct-abl x delta) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; The first three lines of this file were inserted by DrRacket. They record metadata | |
| ;; about the language level of this file in a form that our tools can easily process. | |
| #reader(lib "htdp-intermediate-reader.ss" "lang")((modname invert) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f))) | |
| (define (invert lst) | |
| (cond [(empty? lst) empty] | |
| [else (append (invert (rest lst)) (cons (first lst) empty))])) | |
| (check-expect (invert empty) empty) | |
| (check-expect (invert (list 1)) (list 1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/python3 | |
| # Example output: | |
| # Enter a number:1024 | |
| # Number: 1024 | |
| # Needed bits: 11 | |
| # Bytes (unsigned) 100 0000 0000 | |
| # Bytes (two-complement) 0100 0000 0000 | |