Skip to content

Instantly share code, notes, and snippets.

View mechastorm's full-sized avatar

Shih Oon Liong mechastorm

View GitHub Profile
@iAugur
iAugur / ansible-add-string-to-line.yml
Last active May 14, 2024 12:37
Ansible: Add a String to an existing line in a file
# Adapted from solution provided by http://stackoverflow.com/users/57719/chin-huang http://stackoverflow.com/a/31465939/348868
# Scenario: You want to add a group to the list of the AllowGroups in ssh_config
# before:
# AllowGroups Group1
# After:
# AllowGroups Group1 Group2
- name: Add Group to AllowGroups
replace:
backup: yes
@hongkongkiwi
hongkongkiwi / generate-ssh-key
Last active December 18, 2023 07:45
Simple one liner to generate an SSH key without a password in the default place with the comment as hostname then print out the public key for copy and paste.
HOSTNAME=`hostname` ssh-keygen -t rsa -C "$HOSTNAME" -f "$HOME/.ssh/id_rsa" -P "" && cat ~/.ssh/id_rsa.pub
from flask import current_app
class FeatureFlags(object):
def __init__(self, app=None):
if app is not None:
self.init_app(app)
def init_app(self, app):
@philsturgeon
philsturgeon / 0-intro.md
Last active June 7, 2018 09:34
PSR-2 v CodeSniffer PSR-2

This is a list of issues or discrepencies between the wording or intention of PSR-2 itself and the CodeSniffer PSR-2 ruleset.

Add suggestions in the comments or tweet me (@philsturgeon) if you have more inconsistencies to report.

@jgeurts
jgeurts / statsd-graphite-install.sh
Last active January 28, 2017 20:23
Install statsd and graphite as a services on Ubuntu 13.10
sudo apt-get install --assume-yes python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install --assume-yes nodejs
sudo apt-get install --assume-yes git
# Install Graphite
sudo apt-get install python-dev ruby-dev bundler build-essential libpcre3-dev graphite-carbon graphite-web
cat >> /tmp/graphite-carbon << EOF
# Change to true, to enable carbon-cache on boot
@mechastorm
mechastorm / FB Locale List
Created September 4, 2012 21:27
List of locales supported by Facebook. These are the same supported locales that you can only call when loading the FB JS SDK
<?php
/**
* List of locales supported by Facebook.
*
* These are the same supported locales that you can only call when loading the FB JS SDK at
* //connect.facebook.net/{LOCALE_ID}/all.js
*
* Locales taken from http://www.facebook.com/translations/FacebookLocales.xml
*
* Last Updated: 04/09/2012