Skip to content

Instantly share code, notes, and snippets.

View kj54321's full-sized avatar
🤠

Donny Jie kj54321

🤠
View GitHub Profile
{
"kind": "Template",
"apiVersion": "v1",
"metadata": {
"name": "a-quickstart-keyvalue-application",
"creationTimestamp": null,
"annotations": {
"description": "This is an example of a Ruby and MySQL application on OpenShift 3",
"iconClass": "icon-ruby",
"tags": "instant-app,ruby,mysql"
@kj54321
kj54321 / nginx.conf
Created December 6, 2016 13:21 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@kj54321
kj54321 / copy_remotely
Created January 9, 2017 13:38 — forked from aseigneurin/copy_remotely
Ansible module to copy a file if the MD5 sum of the target is different
#!/usr/bin/python
DOCUMENTATION = '''
---
module: copy_remotely
short_description: Copies a file from the remote server to the remote server.
description:
- Copies a file but, unlike the M(file) module, the copy is performed on the
remote server.
The copy is only performed if the source and destination files are different
(different MD5 sums) or if the destination file does not exist.
@kj54321
kj54321 / ovpn_easyrsa_pki.md
Created January 21, 2017 12:13 — forked from epcim/ovpn_easyrsa_pki.md
openvpn easy-rsa certs (+revoke)
@kj54321
kj54321 / main.yml
Created June 8, 2017 07:51 — forked from rothgar/main.yml
Generate /etc/hosts with Ansible
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
for i in setup/*; do echo $if; jq '[.ansible_facts.ansible_hostname,.ansible_facts.ansible_devices.sda.size , .ansible_facts.ansible_all_ipv4_addresses[0]]' -c $i;done >list
and then, note the | @csv
for i in setup/*; do echo $if; jq '[.ansible_facts.ansible_hostname,.ansible_facts.ansible_devices.sda.size , .ansible_facts.ansible_all_ipv4_addresses[0]] | @csv' -r $i;done
"qa-pgdb01","120.00 GB","10.100.13.70"
for i in setup/*; do jq '[ .ansible_facts.ansible_hostname, .ansible_facts.ansible_all_ipv4_addresses[0] ] | join(", ")' -j $i;echo;done
qa-pgdb01, 10.100.13.70
@kj54321
kj54321 / sed.txt
Created August 4, 2017 03:56 — forked from shreeshga/sed.txt
sed quick help guide
HANDY ONE-LINERS FOR SED (Unix stream editor) Oct. 29, 1997
compiled by Eric Pement <epement@jpusa.chi.il.us> version 4.3
Latest version of this file is always at <http://www.wollery.demon.co.uk>
FILE SPACING:
# double space a file
sed G
# triple space a file
sed 'G;G'
@kj54321
kj54321 / rmconfirm.sh
Created August 10, 2017 04:25 — forked from douglas-vaz/rmconfirm.sh
Script that confirms an "rm" call. Add "alias rm=rmconfirm.sh" to ~/.bashrc
#!/bin/bash
inp="No";
echo "Are you SURE you want to delete file(s) in $(pwd)? (No/yes)"
read inp
if [ "$inp" == "yes" ];then
echo "Removing..."
rm $@
else
exit 1
@kj54321
kj54321 / disable mcafee endpoint protection.md
Created August 25, 2017 13:21 — forked from tegansnyder/disable mcafee endpoint protection.md
Disable McAffee Endpoint Protection OSX

method 1

sudo /usr/local/McAfee/AntiMalware/VSControl stopoas

alternatively

sudo defaults write /Library/Preferences/com.mcafee.ssm.antimalware.plist OAS_Enable -bool False
sudo /usr/local/McAfee/AntiMalware/VSControl stop
sudo /usr/local/McAfee/AntiMalware/VSControl reload
@kj54321
kj54321 / ipin.py
Created October 8, 2017 14:28 — forked from urielka/ipin.py
iOS PNG uncrushers based on http://www.axelbrz.com.ar/?mod=iphone-png-images-normalizer with a fix for multiple IDAT
#---
# iPIN - iPhone PNG Images Normalizer v1.0
# Copyright (C) 2007
#
# Author:
# Axel E. Brzostowski
# http://www.axelbrz.com.ar/
# axelbrz@gmail.com
#
# References: