This file contains 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
public class Main { | |
public static void main(String[] args) { | |
try { | |
java.net.InetAddress hostname = java.net.InetAddress.getLocalHost(); | |
String hname = hostname.getHostName(); | |
System.out.println("Hostname: " + hname); | |
} catch(Exception e) { | |
This file contains 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
// Euler.java | |
public class Main { | |
public static void main(String[] args) { | |
int sum = 0; | |
for(int i=1; i<1000; i++) { | |
if( ((i%3)==0) || ((i%5)==0) ) { | |
sum += i; | |
System.out.println("i=" +i + " Sum=" + sum); |
This file contains 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
/** | |
* Euler2.java | |
* | |
* @author jonas | |
*/ | |
public class Main { | |
/** | |
* @param args the command line arguments | |
*/ |
This file contains 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
// Klocka.java | |
import java.awt.*; | |
import java.util.Date; | |
public class Klocka extends java.applet.Applet | |
implements Runnable { | |
Font teckensnittet=new | |
Font("Helvetica",Font.BOLD,18); |
This file contains 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
// Iteratedirs | |
import java.io.*; | |
import java.util.Iterator; | |
//import java.util.Vector; | |
import java.util.ArrayList; | |
/** | |
* |
This file contains 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
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>[404] Document Not Found</title> | |
<link rel="stylesheet" href="/blue-screen-of-death.css" type="text/css"></link> | |
<style> | |
html, body { | |
color: white; | |
background-color: #000080; | |
} |
This file contains 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
<?php | |
function mkpasswd($min, $max) | |
{ | |
$pwd = ""; | |
for($i=0; $i<rand($min,$max); $i++) | |
{ | |
$num = rand(48,122); | |
if(($num >48 && $num < 57) || ($num >65 && $num < 90) || ($num > 97 && $num < 122)) | |
{ |
This file contains 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
<?php | |
/* | |
* Reset the admin password in a Wordpress site. Run this script from CLI! | |
*/ | |
if($argc == 1) { die("[Error] You must specify the domainname!\nSyntax: ./$argv[0] <domainname>\n\n"); } | |
$_SERVER['HTTP_HOST'] = $argv[1]; | |
printf("Trying to reset your administrative password, if successful you should get a [OK] back.\n\n"); | |
define( 'WPPATH', dirname(__FILE__).'/' ); | |
require( WPPATH.'wp-load.php' ); |
This file contains 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
<?php | |
// Remove illegal chars, replacing them with a dash (-) | |
$str = "abc är du här? eLLller ELLER kanske däår?"; | |
$str = preg_replace('/[^0-9a-zA-Z]+/', '-', $str); | |
// results in -> "abc-r-du-h-r-eLLller-ELLER-kanske-d-r-" | |
echo $str.PHP_EOL; |
This file contains 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
;;Small minor mode to control spotify from emacs | |
(defun spotify-play () "Play Spotify" (interactive) | |
(shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Play")) | |
(defun spotify-pause () "Pause Spotify" (interactive) | |
(shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause")) | |
(defun spotify-playpause () "Play/Pause Spotify" (interactive) | |
(shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause")) |
OlderNewer