Skip to content

Instantly share code, notes, and snippets.

View channaveer's full-sized avatar

Channaveer Hakari channaveer

View GitHub Profile
@DesolatorMagno
DesolatorMagno / Dockerfile
Last active October 10, 2020 19:22
docker-composer config01
FROM phpdockerio/php73-fpm:latest
WORKDIR "/application"
# Fix debconf warnings upon build
ARG DEBIAN_FRONTEND=noninteractive
# Install selected extensions and other stuff
RUN apt-get update \
&& apt-get -y --no-install-recommends install php7.3-mysql \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
@gbarreiro
gbarreiro / docker-compose.yml
Last active February 17, 2021 14:56
Docker Compose sample file
version: "3.8"
services:
database:
image: mysql:latest
volumes:
- db-data:/var/lib/mysql/data
command: --default-authentication-plugin=mysql_native_password # run this command in the container
networks:
- database-api
restart: always # the container must be always on
@lukecurtis93
lukecurtis93 / UserSubscriptionRepositoryTest.php
Last active September 9, 2021 11:18
Mock Stripe in a Test
<?php
namespace Tests\Unit;
use Illuminate\Foundation\Testing\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class UserSubscriptionRepositoryTest extends TestCase
{
use CreatesApplication, RefreshDatabase;
@thomasvs
thomasvs / mysql_replication_autostart.sh
Created October 16, 2016 01:31 — forked from nicomak/mysql_replication_autostart.sh
This script automates the process of starting a Mysql Replication on 1 master node and N slave nodes. More details on how it works at http://blog.ditullio.fr/2016/04/30/initialize-mysql-master-slave-replication-script/
#!/bin/bash
#title : replication-start.sh
#description : This script automates the process of starting a Mysql Replication on 1 master node and N slave nodes.
#author : Nicolas Di Tullio
#date : 20160706
#version : 0.2
#usage : bash mysql_replication_autostart.sh
#bash_version : 4.3.11(1)-release
#=============================================================================
@mbijon
mbijon / xss_clean.php
Last active November 1, 2022 03:23
XSS filtering in PHP (cleans various UTF encodings & nested exploits)
<?php
/*
* XSS filter, recursively handles HTML tags & UTF encoding
* Optionally handles base64 encoding
*
* ***DEPRECATION RECOMMENDED*** Not updated or maintained since 2011
* A MAINTAINED & BETTER ALTERNATIVE => kses
* https://github.com/RichardVasquez/kses/
*
* This was built from numerous sources
@eimg
eimg / pdo-wrapper.php
Last active November 29, 2022 11:20
Simple yet secure PHP PDO database wrapper with CRUD methods...
<?php
# PDO Wrapper, supporting MySQL and Sqlite
# Usage:
# $db = new db();
#
# // table, data
# $db->create('users', array(
# 'fname' => 'john',
# 'lname' => 'doe'
# ));
@gbarreiro
gbarreiro / Dockerfile
Created September 17, 2020 14:09
Sample Dockerfile for creating a Docker image
# Use an Ubuntu image as base image
FROM ubuntu:latest
# Metadata for the container
LABEL description="This is a dummy container" author="Guillermo Barreiro"
# Set the working directory inside the container for the following Dockerfile instructions
WORKDIR /root
# Use an argument sent to the "docker build" command inside the Dockerfile
@Pen-y-Fan
Pen-y-Fan / Test Driven Laravel from Scratch.md
Created May 5, 2019 08:28
Test Driven Laravel from Scratch by Adam Wathan

Test Driven Laravel from Scratch

https://vimeo.com/151390908 by Adam Wathan 26 min ~2015.

One of the biggest hurdles in getting started with test driven development with a brand new application is knowing exactly what test to write first. In this screencast, I walk through using outside-in TDD to drive out a feature from scratch in a brand new untouched Laravel application.

Notes & disclaimer

  • The purpose of these notes are to follow the above tutorial, making detailed notes of each step.
@cspray
cspray / 000-java-php-diff.md
Last active July 5, 2023 12:29
A list of differences I've noticed between PHP and Java.

Java vs. PHP

As is pretty obvious by my blog, GitHub repos and my job I'm a PHP developer. I'm also pretty adept with JavaScript and SQL. Lately I've been getting back into Java development a little more seriously. This gist is a series of short articles about some of the differences I've noticed between PHP and Java.

To be specific my Java development recently has been web development using Google App Engine. I am intending to create a RESTful API utilizing the language.

The differences discussed are not intended to be an indictment against either language. Some things about PHP I really like, some things about PHP I really dislike. The same goes for Java. Some things PHP is really good for and other things Java is really good for. This is not meant to be a religious war between languages.

I realize that in a way this is comparing apples and oranges. PHP is a dynamic, interpreted (althought yes it is still compiled) scripting language while Jav

@kixorz
kixorz / aws_autoscaling_cron.rb
Created March 20, 2013 22:41
Running cron jobs in AWS Auto Scaling group is tricky. When you deploy the same code and configuration to all instances in the group, cron job would run on all of them. You may not want that. This script detects the first instance in the group and allows only this instance to run the job. IAM user used by this script needs to have permissions to…
#!/usr/bin/env ruby
require 'syslog'
require 'net/http'
require 'aws-sdk'
Syslog.open
AWS.config({
:access_key_id => '<iam user key>',
:secret_access_key => '<iam user secret>'