Skip to content

Instantly share code, notes, and snippets.

View Ammly's full-sized avatar
🏠
Working from home

Ammly Ammly

🏠
Working from home
View GitHub Profile
# --- Do not remove these libs ---
from freqtrade.strategy.interface import IStrategy
from pandas import DataFrame
import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib
# --------------------------------
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
# isort: skip_file
# --- Do not remove these libs ---
import numpy as np # noqa
import pandas as pd # noqa
from pandas import DataFrame
from freqtrade.strategy.interface import IStrategy
# --------------------------------
@Ammly
Ammly / Dockerfile
Created December 2, 2020 22:26
Install Jenkins and php7.4 through Docker
FROM jenkins/jenkins:2.263.1-centos7
USER root
RUN yum update -y && yum install epel-release -y
RUN rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm
RUN yum install yum-utils -y
RUN yum-config-manager --enable remi-php74 -y && yum install php -y
RUN yum --enablerepo=remi install php-pdo php-mbstring php-xml php-pdo_mysql php-xdebug -y
RUN yum update -y
RUN cd /tmp
RUN curl -sS https://getcomposer.org/installer | php
@Ammly
Ammly / install-docker.sh
Last active November 27, 2020 17:44
Install Docker, Docker-Compose and Git on Amazon Linux 2
#!/bin/bash
sudo yum update -y
sudo amazon-linux-extras install docker -y
sudo yum install docker -y
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo chkconfig docker on
docker info
@Ammly
Ammly / amazon-linux2-userdata
Last active September 16, 2023 06:25
Amazon Linux 2 Laravel, Nginx, PHP7.4, Mariadb Userdata
#!/bin/sh
sudo yum update -y
sudo amazon-linux-extras install nginx1 php7.4 -y
sudo yum clean metadata
sudo yum install git mariadb-server php-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip} -y
# Back up existing config
sudo cp -R /etc/nginx /etc/nginx-backup
sudo chmod -R 777 /var/log
sudo chown -R ec2-user:ec2-user /usr/share/nginx/html
echo "<?php phpinfo(); ?>" > /usr/share/nginx/html/index.php
@Ammly
Ammly / nginx.conf
Created November 21, 2020 17:56
EC2 laravel nginx config
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
@Ammly
Ammly / enable-hibernate-arch-linux.md
Created August 2, 2019 16:32 — forked from klingtnet/enable-hibernate-arch-linux.md
Enable hiberate in Arch Linux usind kernel 4+, grub2 and a swapfile

This guide is based on the hibernate article from the Arch wiki.

  • edit /etc/default/grub and add resume as well as resume_offset kernel parameters
    • resume=UUID=abcd-efgh contains the UUID of the partition on which the swapfile resides. In most cases the swapfile resides in root, to identify the root parition's UUID run blkid or lsblk -O.
    • resume_offset=1234 is the offset of the swapfile from the partition start. The offset is the first entry in the physical_offset column of the output of filefrag -v /swapfile.
    • update grub: grub-mkconfig -o /boot/grub/grub.cfg
    • example: GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=75972c96-f909-4419-aba4-80c1b74bd605 resume_offset=1492992"
  • add the resume module hook to /etc/mkinitcpio.conf:
    • HOOKS="base udev resume autodetect ...
  • rebuild the initramfs mkinitcpio -p linux
@Ammly
Ammly / ansible_local_playbooks.md
Created May 10, 2019 12:10 — forked from alces/ansible_local_playbooks.md
How to run an Ansible playbook locally
  • using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
  • using inventory:
127.0.0.1 ansible_connection=local
@Ammly
Ammly / accountBalance.php
Created February 14, 2019 17:06
JengaHq API Requests using GuzzleHttp for php
<?php
$account_id ={accountId};
$country_code='KE';
$date = date('Y-m-d');
$plainText = $account_id.$country_code.$date;
$privateKey = openssl_pkey_get_private('file://'.storage_path('privatekey.pem'));
$token = {token}; //returned from token function above
@Ammly
Ammly / gist:ff4f5ad2ce7080ef9a7ceeb9d499936e
Created February 13, 2019 16:37 — forked from kyledrake/gist:d7457a46a03d7408da31
Creating a self-signed SSL certificate, and then verifying it on another Linux machine
# Procedure is for Ubuntu 14.04 LTS.
# Using these guides:
# http://datacenteroverlords.com/2012/03/01/creating-your-own-ssl-certificate-authority/
# https://turboflash.wordpress.com/2009/06/23/curl-adding-installing-trusting-new-self-signed-certificate/
# https://jamielinux.com/articles/2013/08/act-as-your-own-certificate-authority/
# Generate the root (GIVE IT A PASSWORD IF YOU'RE NOT AUTOMATING SIGNING!):
openssl genrsa -aes256 -out ca.key 2048
openssl req -new -x509 -days 7300 -key ca.key -sha256 -extensions v3_ca -out ca.crt