Compare commits

...

4 Commits

15 changed files with 264 additions and 0 deletions

View File

@ -625,3 +625,16 @@ def traverse_neighborly_node(
continue
yield from traverse_neighborly_node(neighbor, memo)
def find_min_in_rotated_array(nums: list[int]) -> int:
if nums[0] <= nums[-1]:
return nums[0]
if len(nums) <= 3:
return min(nums)
if nums[len(nums) // 2] > nums[-1]:
return find_min_in_rotated_array(nums[len(nums) // 2 :])
return find_min_in_rotated_array(nums[: (len(nums) // 2) + 1])

View File

@ -491,3 +491,15 @@ def test_copy_neighborly_node(inlist):
assert id(orig) != id(copied)
assert orig == copied
assert stuff.neighborly_node_to_list(orig) == stuff.neighborly_node_to_list(copied)
@pytest.mark.parametrize(
("nums", "expected"),
[
([3, 4, 5, 1, 2], 1),
([4, 5, 6, 7, 0, 1, 2], 0),
([11, 13, 15, 17], 11),
],
)
def test_find_min_in_rotated_array(nums: list[int], expected: int):
assert stuff.find_min_in_rotated_array(nums) == expected

1
personal-home-page/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/vendor/

View File

@ -0,0 +1,11 @@
<?php
require_once 'vendor/autoload.php';
$hello_cmd = new Commando\Command();
$hello_cmd->option()->require()->describedAs('A person\'s name');
$name = $hello_cmd[0];
echo "Hello, $name", PHP_EOL;

View File

@ -0,0 +1,14 @@
{
"name": "meatballhat/personal-home-page",
"type": "library",
"require": {
"nategood/commando": "^0.4.0"
},
"license": "MIT",
"authors": [
{
"name": "Dan Buch",
"email": "dan@meatballhat.com"
}
]
}

124
personal-home-page/composer.lock generated Normal file
View File

@ -0,0 +1,124 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "4aa26239cdb17b13a548c56ac84b5749",
"packages": [
{
"name": "kevinlebrun/colors.php",
"version": "0.4.1",
"source": {
"type": "git",
"url": "https://github.com/kevinlebrun/colors.php.git",
"reference": "d132f36d06e48ea080855af19b4bcb1fb615224a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kevinlebrun/colors.php/zipball/d132f36d06e48ea080855af19b4bcb1fb615224a",
"reference": "d132f36d06e48ea080855af19b4bcb1fb615224a",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"satooshi/php-coveralls": "dev-master",
"squizlabs/php_codesniffer": "1.*"
},
"type": "library",
"autoload": {
"psr-0": {
"Colors": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kevin Le Brun",
"email": "lebrun.k@gmail.com",
"homepage": "http://kevinlebrun.fr",
"role": "developer"
}
],
"description": "Colors for PHP CLI scripts",
"homepage": "https://github.com/kevinlebrun/colors.php",
"keywords": [
"cli",
"color",
"colors",
"console",
"shell"
],
"support": {
"issues": "https://github.com/kevinlebrun/colors.php/issues",
"source": "https://github.com/kevinlebrun/colors.php/tree/0.4.1"
},
"time": "2014-12-23T01:23:37+00:00"
},
{
"name": "nategood/commando",
"version": "0.4.0",
"source": {
"type": "git",
"url": "https://github.com/nategood/commando.git",
"reference": "8fedd49fcb694faf60d87d5c2c4defdffa298fa0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nategood/commando/zipball/8fedd49fcb694faf60d87d5c2c4defdffa298fa0",
"reference": "8fedd49fcb694faf60d87d5c2c4defdffa298fa0",
"shasum": ""
},
"require": {
"kevinlebrun/colors.php": "~0.2",
"php": ">=5.6"
},
"type": "library",
"autoload": {
"psr-0": {
"Commando": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nate Good",
"email": "me@nategood.com"
}
],
"description": "PHP CLI Commando Style",
"homepage": "http://github.com/nategood/commando",
"keywords": [
"automation",
"cli",
"command",
"command line",
"command line interface",
"scripting"
],
"support": {
"issues": "https://github.com/nategood/commando/issues",
"source": "https://github.com/nategood/commando/tree/v0.4.0"
},
"time": "2019-07-10T02:37:11+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.6.0"
}

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
echo "<h3>Hi, I'm a PHP script!</h3>";
?>
</body>
</html>

View File

@ -0,0 +1,35 @@
<?php
$name = 'Flavio';
var_dump($name);
$age = 20;
var_dump($age);
$base = 20;
$height = 10;
$area = $base * $height;
$test = 'an example';
$example = "This is $test";
print $example . "\n";
$firstName = 'Flavio';
$lastName = 'Copes';
$fullName = $firstName . ' ' . $lastName;
print '$fullName = ' . $fullName . "\n";
print strlen($fullName) . "\n";
$weirdName = str_replace('avio', 'ower', $fullName);
print '$weirdName = ' . $weirdName . "\n";
print 'exploded $weirdName = ' . var_dump(explode(' ', $weirdName)) . "\n";

View File

@ -0,0 +1 @@
<?php phpinfo(); ?>

View File

@ -0,0 +1,6 @@
<pre>
<?php
echo $_SERVER['HTTP_USER_AGENT'], PHP_EOL;
var_dump($_SERVER);
?>
</pre>

1
umn-kauffman/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.s

7
umn-kauffman/exchange.c Normal file
View File

@ -0,0 +1,7 @@
long
exchange(long *xp, long y)
{
long x = *xp;
*xp = y;
return x;
}

11
umn-kauffman/goop.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
int
main(int argc, char *argv[])
{
for (int i = argc; i > -1; i--) {
printf("(%d): %s\n", i, argv[i]);
}
return 0;
}

View File

@ -0,0 +1,8 @@
#include <unistd.h>
int
main(int argc, char *argv[])
{
char * buf = "hello\n";
write(1, buf, 6);
}

9
umn-kauffman/mstore.c Normal file
View File

@ -0,0 +1,9 @@
long
mult2(long a, long b);
void
multstore(long x, long y, long *dest)
{
long t = mult2(x, y);
*dest = t;
}