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
from mpl_toolkits.basemap import Basemap | |
import matplotlib.pyplot as plt | |
import numpy as np | |
# set up orthographic map projection with | |
# perspective of satellite looking down at 50N, 100W. | |
# use low resolution coastlines. | |
map = Basemap(projection='ortho',lat_0=45,lon_0=-100,resolution='l') | |
# draw coastlines, country boundaries, fill continents. | |
map.drawcoastlines(linewidth=0.25) | |
map.drawcountries(linewidth=0.25) |
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
/////////////////////////////////////////////////////////////////////////////////// | |
// file: Station.cpp | |
// Job: holds the Station definitions | |
////////////////////////////////////////////////////////////////////////////////// | |
#include <iostream> | |
#include "Station.h" | |
#include "Pump.h" | |
using namespace std; |
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
const CONTRACT_NAME: &str = "crates.io:my-crate-name"; | |
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); | |
#[entry_point] | |
pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result<Response, ContractError> { | |
let ver = cw2::get_contract_version(deps.storage)?; | |
// ensure we are migrating from an allowed contract | |
if ver.contract != CONTRACT_NAME { | |
return Err(StdError::generic_err("Can only upgrade from same type").into()); | |
} |
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
/////////////////////////////////////////////////////////////////////////////////// | |
// file: Car.cpp | |
// Job: holds the Car definitions | |
////////////////////////////////////////////////////////////////////////////////// | |
#include "Car.h" | |
#include "Station.h" | |
using namespace std; | |
extern void testACar(void*); |
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
// Define the custom attribute | |
#[attribute] | |
pub struct MyCustomAttribute { | |
pub name: String, | |
} | |
// Attach the custom attribute to a function | |
#[MyCustomAttribute(name = "my_function")] | |
fn my_function() { | |
// Function body |
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
/////////////////////////////////////////////////////////////////////////////////// | |
// TODO:: #include any needed files | |
/////////////////////////////////////////////////////////////////////////////////// | |
#include <thread> | |
#include <random> | |
#include <vector> | |
#include <mutex> | |
#include <condition_variable> | |
#include <atomic> | |
#include <iostream> |
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
/////////////////////////////////////////////////////////////////////////////////// | |
// TODO:: Add any needed includes | |
// https://man7.org/linux/man-pages/man3/pthread_detach.3.html | |
/////////////////////////////////////////////////////////////////////////////////// | |
#include <iostream> | |
#include <random> | |
#include <string> | |
#include <thread> | |
#include <mutex> | |
#include <vector> |
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
#include <atomic> | |
#include <condition_variable> | |
#include <mutex> | |
#include <thread> | |
#include <iostream> | |
using std::thread; | |
std::mutex count_mutex; | |
std::condition_variable starting_gun_condition; | |
std::mutex starting_gun_mutex; |
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
std::vector<int>foo{ -3, -2, -1, 0, 1, 2, 3 }; | |
std::vector<int>bar; | |
int min = 0; | |
std::copy_if(foo.begin(), foo.end(), std::back_inserter(bar), [](int i) {return i <= 0;}); | |
for (auto x : bar) | |
std::cout << x << "\n"; |
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
# Utilizando la librería Scikit-learn, crea una data sintética de 2000 muestras y 3 características (features). | |
# Haz un clustering utilizando el método k-means | |
import numpy as np | |
# Define the seed so that results can be reproduced | |
seed = 11 | |
rand_state = 11 | |
# Needed for plotting | |
import matplotlib.colors |