Skip to content

Instantly share code, notes, and snippets.

View tertek's full-sized avatar

Ekin Tertemiz tertek

View GitHub Profile
@tertek
tertek / initial_setup.sh
Created January 22, 2024 07:50
Initial Setup Script for a VPS running Linux Ubuntu
#!/bin/bash
set -euo pipefail
########################
### SCRIPT VARIABLES ###
########################
# Name of the user to create and grant sudo privileges
USERNAME=sammy
@tertek
tertek / remote-odk.py
Last active December 5, 2023 09:24
Test python remote code execution for zapier
def hello():
return "Hello World from Github"
test = hello()
output = [{'test-2': test}]
@tertek
tertek / squash_git_commits_after_push.md
Last active February 3, 2023 08:39
Squash git commits and push to remote

Squash <n-amount-of-last-commits> locally for <branch>

$ git rebase -i origin/<branch>~<n-amount-of-last-commits> <branch>

and then force push to remote <branch>

git push origin +

@tertek
tertek / redcap-testing.php
Last active August 19, 2022 10:39
REDCap Testing Helpers
<?php
function addRepeatingForm($projectId=null, $eventId=null, $form=null, $customLabel=null) {
// Prepare parameters
if($projectId === null) {
$projectId = PROJECT_ID;
}
if($eventId === null){
@tertek
tertek / pcov-code-coverage-windows.md
Last active August 18, 2022 09:22
PHPUnit Code-Coverage with PCOV on Windows (Local Development Environment)

PHPUnit Code-Coverage with PCOV on Windows

Download and Install PCOV

  1. Download latest release (currently 1.0.11) for Windows for your version of PHP and the correct format (ts or nts) from PECL
  2. Unzip downloaded package and copy the files php_pcov.dll and php_pcov.pdb to your PHP extensions directory, e.g. C:\bin\php\php-7.4.27-Win32-vc15-x64\ext\
  3. Modify your php.ini so that PCOV is loaded. Therefore add extension=pcov:
..
extension=fileinfo
extension=gd2
@tertek
tertek / local-composer-package.md
Created August 16, 2022 06:46
Local Composer Package Development

Example package with structure:

project
│   composer.json
│   ...
│
└───packagename
│   │   composer.json
│   │
│ └───src
@tertek
tertek / install-poppler-ubuntu.md
Last active June 29, 2022 10:51 — forked from Dayjo/install-poppler-ubuntu.md
How to install Poppler on Ubuntu

First install all these prerequisites for compiling:

sudo apt install g++ libboost-all-dev autoconf libfontconfig1-dev pkg-config libjpeg-dev libopenjp2-7-dev gnome-common libglib2.0-dev gtk-doc-tools libyelp-dev yelp-tools gobject-introspection libsecret-1-dev libnautilus-extension-dev

First download the encoding files (no need to compile these) to the current working directory

wget https://poppler.freedesktop.org/poppler-data-0.4.11.tar.gz
@tertek
tertek / install-old-gcc.md
Last active June 21, 2022 13:36
How to install older gcc versions on Linux

Manual Install

Basic instructions: https://gcc.gnu.org/install/index.html

  1. Download source from mirror && unpack
  2. Download prerequirements with script ./contrib/download_prerequisites
  3. sudo apt-get install gcc-multilib
  4. Run configuration script
  5. Run make
  6. Run install
@tertek
tertek / docker-commands.sh
Last active June 8, 2022 15:07
Useful Docker Commands
# Clear Build Cache
# https://docs.docker.com/engine/reference/commandline/builder_prune/
$ docker builder prune
# Remove Image
# https://docs.docker.com/engine/reference/commandline/image_rm/
$ docker image rm IMAGE
# Run docker build with output to console
# https://stackoverflow.com/a/69524819/3127170
@tertek
tertek / .htaccess
Last active June 7, 2022 06:52
Rewrite Rules needed for pretty URLs for the REDCap Module Repo API
RewriteEngine On
# Rewrite Rules needed for pretty URLS for the Modules API
# Add trailing slash to all requests within /api directory
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
# Route URL Query parameters to pretty URls with "endpoints" - DO NOT CHANGE THE ORDER - can break things
RewriteRule ^v1/$ ?NOAUTH&pid=472&type=module&prefix=em_submission_module&page=module-repo-api