Skip to content

Instantly share code, notes, and snippets.

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

Andre Marcelo-Tanner kzap

🏠
Working from home
View GitHub Profile
@kzap
kzap / docker-compose-sample.yml
Last active March 24, 2018 08:30
Sample Docker Compose V3 File for Docker Stack from the official docs: https://docs.docker.com/compose/compose-file/#compose-file-structure-and-examples
version: "3"
services:
redis:
image: redis:alpine
ports:
- "6379"
networks:
- frontend
deploy:
@kzap
kzap / galleon-culture.md
Last active December 8, 2017 13:01
Galleon Tech Culture

Galleon.PH Culture

Galleon.PH is a e-commerce logistics company that enables Filipinos to buy any product from anywhere in the world.

We foster a culture that enables its developers to grow and flourish.

Everyone is Responsible

  • All developers are treated like adults and are responsible for the code they write.

Keybase proof

I hereby claim:

  • I am kzap on github.
  • I am kzap (https://keybase.io/kzap) on keybase.
  • I have a public key ASDoqnmlxM7JdIPjl7kUb4EbSLl_Q9huvqAWobU60SVavAo

To claim this, I am signing this object:

@kzap
kzap / showCommitsByAuthorDate.sh
Last active April 20, 2017 19:23
Show Git Commits Across All Branches By Dates in Reverse Order (By Author Date)
# show author date and grep matching dates
git log --pretty=format:"%C(yellow)%h%Creset%C(cyan)%C(bold)%d%Creset %C(cyan)(%cr|%ai)%Creset %C(green)%aE%Creset %s" \
--all --no-merges --reverse --author="Andre" | grep -E "2017-01-(0[1-9]|1[0-9]|2[0-9]|3[0-1])"
@kzap
kzap / instructions.md
Last active April 14, 2016 11:58
How to use python-openstackclient with Dream Compute

Install python-novaclient 2.30.2 pip install -I python-novaclient==2.30.2

Install python-openstackclient pip install python-openstackclient

Create your config file: vi ~/.config/openstack/clouds.yaml

 dreamcompute:
@kzap
kzap / addControllerMap.php
Created October 20, 2012 01:35
klein.php controller#action helper function
<?php
function addControllerMap($controllerMapCollection, $method = array('GET', 'POST'), $route = '*', $controllerMap = null) {
global $__controllerMaps;
// parse arguments
$args = func_get_args();
switch (count($args)) {
case 1:
$controllerMap = $controllerMapCollection;
@kzap
kzap / scan-php-exploits.sh
Last active October 11, 2015 16:47
Scan for a file with possible malicious PHP code in it
/usr/bin/find /DIRECTORY/TO/SCAN/ -type f -print0 | /usr/bin/xargs -0 grep 'eval(\$' | /usr/bin/mail -s 'Scan Report' yourname@email.com
@kzap
kzap / gist:34cc7659877f4692e14a
Created September 29, 2015 10:17
AMA Parsing
1.) FIND: ' {AMANAME}: '
REPLACE WITH: ' {AMANAME}! '
2.) FIND: '\[[0-9]{1,2}:[0-9]{2} PM\] ([^:]+)\: ([^\[]+)'
REPLACE WITH: '**Q (\1) : \2**
'
3.) FIND: '
**
@kzap
kzap / ubuntu-init-script.sh
Last active August 29, 2015 14:24
Ubuntu Build Init Script - configures a Rackspace Cloud server with all the necessary things you might want. Recommended flavor is a minimum 4-8GB as the disk partitions for /tmp and /var/log are 4-8GB
#!/bin/bash -x
# DESCRIPTION: The following UserData script is created to configure a Rackspace Cloud server
# with all the necessary things you might want.
# Recommended flavor is a minimum 4-8GB as the disk partitions for /tmp and /var/log are 4-8GB
#
# Can be used from CLI with nova or supernova
# example:
# supernova lincusa boot --image "Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)" --flavor performance1-8 --key-name {YOUR_KEY} --user-data "ubuntu-init-script.sh" --config-drive true {YOUR_SERVER_NAME}
#
@kzap
kzap / useful
Last active August 29, 2015 14:23
Useful Unix Commands
#sql-restore-files
for SQL in *.sql.gz; do DB=${SQL/\.sql.gz/}; echo importing $DB; zcat $SQL | mysql -u root --password='{PASSWORD}' $DB; done
#backup all directories and compress them
find ./* -maxdepth 0 -type d -exec echo "Archiving {}" \; -exec tar -cjf "{BACKUP_DIR}/{}-{DATE}.tar.bz2" \;
#find and replace in files recursive without touching files that dont match
find ./ -type f -name '*.php' -print0 | xargs -0 grep 'FIND' -l | xargs sed -i 's/FIND/REPLACE/g'
#apache max clients recommendation