Skip to content

Instantly share code, notes, and snippets.

View JamesTheHacker's full-sized avatar

0xDEADBEEF JamesTheHacker

  • United Kingdom
View GitHub Profile
sudo -u "${user}" bash -s <<ILOVEBASH
export WP_CLI_CACHE_DIR=${webroot}
cd ${webroot}
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x ${webroot}/wp-cli.phar
./wp-cli.phar core download
./wp-cli.phar config create --dbname="${db_name}" --dbuser="${db_username}" --dbpass="${db_password}" --dbhost="${db_host}"
## Example configuration:
# upstream fastcgi_backend {
# # use tcp connection
# # server 127.0.0.1:9000;
# # or socket
# server unix:/var/run/php/php7.0-fpm.sock;
# }
# server {
# listen 80;
# server_name mage.dev;
@JamesTheHacker
JamesTheHacker / www.conf
Created December 10, 2019 18:59
PHP config
# TODO: Use calculation to set these sizes
sed -r -i 's/^;?pm ?=.*$/pm = dynamic/' /etc/php/7.2/fpm/pool.d/www.conf
sed -r -i 's/^;?pm.max_children ?=.*$/pm.max_children = 25/' /etc/php/7.2/fpm/pool.d/www.conf
sed -r -i 's/^;?pm.start_servers ?=.*$/pm.start_servers = 10/' /etc/php/7.2/fpm/pool.d/www.conf
sed -r -i 's/^;?pm.min_spare_servers ?=.*$/pm.min_spare_servers = 5/' /etc/php/7.2/fpm/pool.d/www.conf
sed -r -i 's/^;?pm.max_spare_servers ?=.*$/pm.max_spare_servers = 20/' /etc/php/7.2/fpm/pool.d/www.conf
sed -r -i 's/^;?pm.max_requests ?=.*$/pm.max_requests = 500/' /etc/php/7.2/fpm/pool.d/www.conf
call plug#begin('C:\Users\Skrimble\AppData\Local\nvim\plugged')
Plug 'C:\ProgramData\chocolatey\bin\fzf.exe'
Plug 'junegunn/fzf.vim'
Plug 'joshdick/onedark.vim'
Plug 'vim-airline/vim-airline'
Plug 'ryanoasis/vim-devicons'
Plug 'mattn/emmet-vim'
Plug 'takac/vim-hardtime'
call plug#end()
@JamesTheHacker
JamesTheHacker / provision.sh
Created December 9, 2019 19:17
WIP provision script for magento
#!/usr/bin/env bash
# Developer: [email protected]
set -o errexit
set -o pipefail
set -o nounset
export DEBIAN_FRONTEND=noninteractive
mode="developer"
default: [SUCCESS]: Magento installation complete.
default: [SUCCESS]: Magento Admin URI: /admin_ysf082
default: Nothing to import.
default: Enabled developer mode.
default: <warning>Warning from repo.magento.com: You haven't provided your Magento authentication keys. For instructions, visit https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html</warning>
default: [SUCCESS]: Magento installation complete.
default: [SUCCESS]: Magento Admin URI: /admin_ysf082
default: Nothing to import.
default: Enabled developer mode.
default: <warning>Warning from repo.magento.com: You haven't provided your Magento authentication keys. For instructions, visit https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html</warning>
# Change permissions for webroot directory
chown "${user}":www-data "${webroot}"
# Create auth.json required for magento installation
sudo -u "${user}" bash -c "mkdir ${home}/.composer"
sudo -u "${user}" bash -c "tee ${home}/.composer/auth.json" > /dev/null <<ILOVEBASH
{
"github-oauth": {
"github.com": "${github_pa_token}"
},
#include <stdio.h>
#include <Windows.h>
/*
* Small utility function to print the values from MEMORY_BASIC_INFORMATION64 struct
*/
void PrintMemoryBasicInformation64(MEMORY_BASIC_INFORMATION64 *mbi)
{
printf("Base Address: %p\n", mbi->BaseAddress);
printf("Allocation Base Address: %p\n", mbi->AllocationBase);
#include <stdio.h>
#include <Windows.h>
int main(int argc, char** argv)
{
int pid = 10964;
DWORD_PTR addr = 0x7FF7BD730000;
/*
* Get a handle for process with specific process id