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
// SPDX-License-Identifier: MIT | |
/** | |
A simple Solidity smart contract which generates a random number between 0 and the desired max number. | |
Uses two functions to generate the random number: | |
- First "prepareRandom" should be called. The function will set the "preparationBlockNumber" to the current block number. | |
- Second "roll" should be called to generate the number. The function generates a random number using current block difficulty, timestamp, caller address, | |
and the blockhash of the block when "prepareRandom" has been called. This way, as the blockhash of the block can't be know before the "prepareRandom" transaction goes thorugh, | |
the result of the roll can't be predicted and thus manipulated. | |
How many times the roll has been called and all the previous results are recorded in the blockchain. |
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
""" | |
Author: Dogu Deniz UGUR (Github: DoguD), 2020 | |
The methodology behind the code has been tried to explained via comments. | |
All assumptions and notes are also mentioned as comments when necessary. | |
""" | |
def get_result(src_list, target, result_list): | |
"""Note: Although I couldn't find a counter example myself this algorithm may not always return the result with shortest | |
number of elements.""" |
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 chalice import Chalice | |
import boto3 | |
import json | |
app = Chalice(app_name='s3_presigned_file_upload') | |
BUCKET_NAME = '<INSERT_BUCKET_NAME_HERE>' | |
REGION = '<INSERT_REGION_HERE>' |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
<CORSRule> | |
<AllowedOrigin>*</AllowedOrigin> | |
<AllowedMethod>HEAD</AllowedMethod> | |
<AllowedMethod>GET</AllowedMethod> | |
<AllowedMethod>PUT</AllowedMethod> | |
<AllowedMethod>POST</AllowedMethod> | |
<AllowedHeader>*</AllowedHeader> | |
</CORSRule> |
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 chalice import Chalice | |
app = Chalice(app_name='s3_presigned_file_upload') | |
@app.route('/') | |
def index(): | |
return {'hello': '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
db_username = <YOUR_DB_USERNAME> | |
db_password = <YOUR_DB_PASSWORD> | |
db_name = <YOUR_DB_NAME> | |
db_endpoint = <YOUR_DB_ENDPOUNT> |
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
default_platform(:android) | |
platform :android do | |
desc "Do UI Tests on CircleCI" | |
lane :ui_test do | |
# Run all Tests | |
sh('cd .. && ./gradlew app:connectedAndroidTest') | |
# Run spesific Tests | |
# sh('cd .. && ./gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.package=<INSERT_YOUR_TEST_PACKAGE_HERE(com.app.myapp.emulatortests)>') | |
end |
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
- run: avdmanager create avd -n Nexus_5X_API_26_x86 -k "system-images;android-26;default;x86" -d "Nexus 5X" | |
- run: osascript ./fastlane/recording_related/dismiss_warning.scpt # Dismisses the same named computer error | |
- run: | |
name: Run emulator in background | |
command: /usr/local/share/android-sdk/tools/emulator @Nexus_5X_API_26_x86 -skin 1080x2066 -memory 2048 -noaudio | |
background: true | |
- run: | |
name: Run Tests | |
command: bundle exec fastlane ui_test | |
no_output_timeout: 30m |
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
- *restore_gradle_cache | |
- *android_dependencies | |
- *save_gradle_cache | |
- *restore_gems_cache | |
- *ruby_dependencies | |
- *save_gems_cache |
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
run: | |
name: Install emulator | |
command: (yes | sdkmanager "platform-tools" "platforms;android-26" "extras;intel;Hardware_Accelerated_Execution_Manager" "build-tools;26.0.0" "system-images;android-26;default;x86" "emulator" --verbose) || true |