Skip to content

Instantly share code, notes, and snippets.

View iconnor's full-sized avatar

Ian Connor iconnor

View GitHub Profile
@iconnor
iconnor / move_docker.sh
Created July 31, 2023 00:43
Move docker with the least downtime possible
#!/bin/bash
# Check if a command line argument is provided
if [ -z "$1" ]
then
# If not, prompt the user to enter the target directory
echo "Please enter the target directory:"
read -r target_dir
else
# If an argument is provided, use it as the target directory
#!/bin/bash
# Function to sign a file
sign_file() {
# Check if file name and private key are provided
if [ $# -ne 2 ]
then
echo "Usage: $0 sign <file_to_sign> <private_key>"
exit 1
fi
@iconnor
iconnor / retaliate.rb
Created November 4, 2019 20:57
Use faker to fill a phishing site with random emails and passwords
require 'faker'
require 'net/http'
phishing_site = 'creeeeooooob.azurewebsites.net'
100.times.map {
source = Net::HTTP.get(phishing_site, '/')
domain = /url\=https\:\/\/([a-z]+)\.com\//.match(source)[1]
100.times.map {
@iconnor
iconnor / .drone.yml
Created July 11, 2019 06:39
Drone CI 1.0 config for Java, Docker, Deployment and Cypress Tests
pipeline:
build:
image: maven:3.3.9-jdk-8
commands: mvn install -DskipNpm -DskipTests
test:
image: maven:3.3.9-jdk-8
commands: mvn integration-test -DskipNpm
buildjs:
image: node:10.16.0-jessie
commands:
@iconnor
iconnor / package.json
Created July 11, 2019 06:37
NPM package to run cypress
{
"name": "yourname",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"prod-build": "ng build --prod --source-map",
"cypress:run": "cypress run",
"cypress:staging": "cypress run --record --key yourrecordkey --env environment=staging",
@iconnor
iconnor / plugins-index.js
Created July 11, 2019 06:35
How cypress runs over staging
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
if (config.env.environment === 'staging') {
config.defaultCommandTimeout = 30000;
config.chromeWebSecurity = false;
config.baseUrl = 'https://staging.yourserveraddress.com';
}
return config;
@iconnor
iconnor / signin.spec.ts
Last active July 11, 2019 06:22
Cypress io signin test
context('Actions', () => {
beforeEach(() => {
cy.visit('/login');
});
it('Bad sign in should fail', () => {
cy.get('#username')
.type('user@projectlounge.com');
cy.get('#password')
.type('Bad pass');
@iconnor
iconnor / default.cong
Created July 11, 2019 05:59
PHP nginx conf file for Docker
# vim: ft=nginx ts=2 sw=2
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
# Make site accessible from http://localhost/
@iconnor
iconnor / Dockerfile
Last active July 11, 2019 06:00
PHP laravel with composer
#start with our base image (the foundation) - version 7.1.5
FROM businesstools/nginx-php:1.8.0
#install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer
#set our application folder as an environment variable
ENV APP_HOME /var/www/html
ENV COMPOSER_ALLOW_SUPERUSER=1
@iconnor
iconnor / Dockerfile
Created July 11, 2019 05:55
Java SpringBoot
FROM openjdk:8-jdk-alpine
RUN apk update \
&& apk add --no-cache curl
HEALTHCHECK --interval=5s --timeout=5s --retries=12 \
CMD curl --silent --fail localhost:8080/actuator/health || exit 1
VOLUME /tmp
ADD target/yourapp-SNAPSHOT.jar app.jar
ENV SPRING_PROFILES_ACTIVE cloud-dev
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]