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
#include <iostream> | |
#include <random> | |
// The number of items to insert into the hash table in main() | |
#define ITEMS 32 | |
// The size of the backing array for the hash table | |
#define HTSIZE 32 | |
using namespace std; |
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
// Generates the first 10 odd squares, lazily. | |
// [1, 9, 25, 49, 81, 121, 169, 225, 289, 361] | |
// That is, it takes an infinite sequence of squares and | |
// checks if each subsequent one is odd, until it finds | |
// ten that are. | |
fn main() { | |
let vector: Vec<_> = (1..) // Instructions to produce | |
// integers forever | |
.map(|x| x * x) // This is now instructions for |
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
extern crate rayon; | |
use rayon::prelude::*; | |
fn fizzbuzz(i: i32) { | |
match (i % 3 == 0, i % 5 == 0) { | |
// Added showing instances where there is no valid divisor on /u/XANI_'s suggestion | |
// I really like it, actually, because it lets you see how the parallel iterator has | |
// chunked up the problem. Very cool. | |
(false, false) => {println!("{} ", i); }, | |
(true, true) => { println!("{}: FizzBuzz", i); }, |
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
[package] | |
name = "rocket_test" | |
version = "0.1.0" | |
authors = ["SilverWingedSeraph <[email protected]>"] | |
[dependencies] | |
rocket = "0.1.3" | |
rocket_codegen = "0.1.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
#!/usr/bin/env python3 | |
# time_download.py | |
# A simple script to time downloads in order to determine | |
# variances in the speed of the network connection used | |
# by the sensor machine. Reports in CSV | |
# YOU NEED TO CHANGE THE TARGET_URI VARIABLE | |
# Please, please, please don't use my cdn for more than a few downloads. | |
# You will end up getting your IP blocked. | |
import requests |
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
################################################################ | |
# pronouns.py - Leonora Tindall | |
# | |
# An example of proper handling of pronoun replacement in | |
# Python, including a selection menu. This handles only | |
# singular pronouns, providing a simple .format() based | |
# interface for replacing pronouns in prose. | |
# This script is limited to English, but a similar technique | |
# should work for most languages using a similar grammar. | |
################################################################ |
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/env python3 | |
""" | |
An async server for base64-encoded reverse shells | |
Allows rashell-cipher clients to connect and get commands | |
Expects network data in base64 wrapping xor enciphered data | |
The XOR key in this script needs to match the client key. | |
Written by Leo Tindall / SilverWingedSeraph | |
This code is covered by a CC-BY-SA 4.0 license. | |
Give attribution and share under the same license. |
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/env python3 | |
""" | |
This is a program to help you study the Japanese numbers. | |
It currently goes from 0 to 99; I will extend it at a later date. | |
It can be executed as follows: | |
./numerica.py |
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
// Data and clock lines for the BlinkyGrid | |
#define BG_CLOCK 2 | |
#define BG_DATA 8 | |
// How long to take for each half cycle | |
#define CL_DELAY 50 | |
// Keep track of the current state of the clock | |
bool c = false; |
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
// Hello! I'm Leo Tindall, the SilverWingedSeraph, and this is a follow-up to my tutorial on | |
// using match expressions in Rust. | |
// In my last video, we created a finite state machine to parse and modify some simple markup. | |
// In this video, we'll make the machine more abstract and more concise. | |
// We'll start out the same way: defining the four states of the machine. | |
// However, we'll use a neat trick that Rust | |
// provides to make things easier later on. We'll ask the compiler to derive the Copy and Clone | |
// traits on MachineState, so we don't have to worry about borrowing and ownership. |