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
################################ | |
# Ubuntu/Debian initial setup | |
################################ | |
# UPDATE PACKAGES | |
sudo apt-get update | |
################ | |
# Python | |
################ | |
# Installing python 3 pip |
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 org.springframework.context.annotation.Configuration; | |
import org.springframework.web.servlet.config.annotation.CorsRegistry; | |
import org.springframework.web.servlet.config.annotation.EnableWebMvc; | |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | |
@Configuration | |
@EnableWebMvc | |
public class WebConfig implements WebMvcConfigurer { |
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 org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import springfox.documentation.builders.PathSelectors; | |
import springfox.documentation.builders.RequestHandlerSelectors; | |
import springfox.documentation.service.ApiInfo; | |
import springfox.documentation.service.Contact; | |
import springfox.documentation.spi.DocumentationType; | |
import springfox.documentation.spring.web.plugins.Docket; | |
import springfox.documentation.swagger2.annotations.EnableSwagger2; |
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 org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.context.annotation.ImportResource; | |
import org.springframework.data.mongodb.MongoDbFactory; | |
import org.springframework.data.mongodb.core.MongoTemplate; | |
import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver; | |
import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper; | |
import org.springframework.data.mongodb.core.convert.MappingMongoConverter; | |
import org.springframework.data.mongodb.core.mapping.MongoMappingContext; |
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: Miguel Angel Luna | |
Description: This is a script to create a quickstart node.js project using Express and MongoDB | |
Instructions: | |
Run the script using "sh initialize_express_mongoose.sh" inside your project folder. Once the script has finished: | |
* Enter your mongoURI in your keys file inside the config folder | |
* Create your routes inside routes/api and use them inside server.js |
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
''' | |
Script to try overload a server. Use it with the command: | |
python ddos_attack.py http://urlToAttack | |
''' | |
import threading, requests, sys | |
def attack(url=sys.argv[1]): | |
try: |
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
package com.miluna.springvehicleguide.security; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.context.annotation.Lazy; | |
import org.springframework.core.annotation.Order; | |
import org.springframework.http.HttpMethod; | |
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | |
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
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
export async function login(email, password) { | |
// send credentials and get authorization token | |
const headers = getDefaultHeaders(); | |
const res = await axios.post(`${config.REST_BASE_URL}/login`, {email: email, password: password}, {headers: headers}) | |
if (res.status === 200){ | |
const authToken = res.data["Authorization"]; | |
// save token to session storage | |
sessionStorage.setItem(STORAGE_KEY_NAME, convertObjectToBase64(authToken)); | |
return true; |
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: Miguel Angel Luna | |
Description: This is a script to create a quickstart react project using Parcel as bundler | |
Instructions: | |
Run the script using "sh react-parcel-script.sh" inside your project folder. | |
If you are running on Windows, use Git Bash as terminal and execute the command. | |
' | |
# Create src dir | |
mkdir src |
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: Miguel Angel Luna | |
Description: This is a script to create a quickstart react project using Parcel as bundler and develop with TypeScript | |
Instructions: | |
Run the script using "sh react-parcel-script.sh" inside your project folder. | |
If you are running on Windows, use Git Bash as terminal and execute the command. | |
' | |
# Create src dir | |
mkdir src |
OlderNewer