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
#!python3 | |
# selenium_forum_poster.py - Scratch forum bot using Selenium | |
import time, pickle, random, os.path | |
from selenium import webdriver | |
RESPONSES = ( | |
"Support.", | |
"No support.", | |
"workaroundable, no support.", | |
"100% support!", |
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
import re | |
from operator import * | |
i=lambda p: p if type(p)!=tuple else{"cons":lambda a,b:(a,b),"car":lambda a:a[0],"cdr":lambda a:a[1],"cadr":lambda a:a[1][0],"+":add,"-":sub,"*":mul,"print":print}[p[0]](*map(i,p[1:])) | |
while 1:i(eval(re.sub("[\n ]+",",",re.sub("[a-z+\-*]+","'\g<0>'",input()).replace("'nil'","''"))or"''")) |
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
"""cloudcoder.py - Utilities for encoding and decoding strings for Scratch cloud data | |
Use the encode and decode functions to prepare strings to be stored in cloud variables | |
and to get strings out of them. | |
Examples: | |
>>> encode("I <3 the cloud") | |
'0x2F49203c332074686520636c6f7564' | |
>>> decode('0x2F49203c332074686520636c6f7564') | |
'I <3 the cloud' |
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
(function(ext) { | |
// Cleanup function when the extension is unloaded | |
ext._shutdown = function() {}; | |
// Status reporting code | |
// Use this to report missing hardware, plugin or unsupported browser | |
ext._getStatus = function() { | |
return {status: 2, msg: 'Ready'}; | |
}; |
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
# First we get Rust ready. | |
echo "Getting Rust ready..." | |
rustup default nightly | |
rustup target add asmjs-unknown-emscripten | |
rustup target add wasm32-unknown-emscripten | |
# Now we get emscripten | |
echo "Rust is ready. Installing Emscripten..." | |
curl -O https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | |
tar -xzf emsdk-portable.tar.gz | |
source emsdk_portable/emsdk_env.sh |
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
fn main() { | |
println!("Hello, JS World!"); | |
} |
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
<!DOCTYPE html> | |
<html lang="de"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Hello from Rust</title> | |
</head> | |
<body> | |
<script src="rust-to-web.js"></script> | |
</body> | |
</html> |
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
<blocks app="Snap! 4.0, http://snap.berkeley.edu" version="1"><block-definition s="SUCESS %'val'" type="reporter" category="other"><header></header><code></code><inputs><input type="%s"></input></inputs><script><block s="doReport"><block s="reportNewList"><list><l>SUCESS</l><block var="val"/></list></block></block></script></block-definition><block-definition s="ERROR %'msg'" type="reporter" category="other"><header></header><code></code><inputs><input type="%s"></input></inputs><script><block s="doReport"><block s="reportNewList"><list><l>ERROR</l><block var="msg"/></list></block></block></script></block-definition><block-definition s="match %'x' with Sucess %'val' %'block1' Error %'msg' %'block2'" type="command" category="control"><header></header><code></code><inputs><input type="%l"></input><input type="%upvar"></input><input type="%cs"></input><input type="%upvar"></input><input type="%cs"></input></inputs><script><block s="doIfElse">< |
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
macro_rules! sequence { | |
($x:ident : $t:ty = $init:expr ; $cond:expr ; $change:expr) => {{ | |
struct Sequence { | |
val: $t, | |
} | |
impl Iterator for Sequence { | |
type Item = $t; | |
#[inline] |
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
use std::cmp::{PartialOrd, Ord, Ordering}; | |
use std::collections::HashSet; | |
// Calculates the highest common factor with Euclid's algorithm | |
// Probably the hottest code. Is there a faster way to calculate the HCF? | |
fn hcf(mut a: i64, mut b: i64) -> i64 { | |
while b != 0 { | |
let temp = (b, a - b*(a/b)); | |
a = temp.0; | |
b = temp.1; |
OlderNewer