Skip to content

Instantly share code, notes, and snippets.

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

Frederic Leger fredleger

🏠
Working from home
View GitHub Profile
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@KartikTalwar
KartikTalwar / Documentation.md
Last active November 18, 2024 03:36
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@nikicat
nikicat / git2dch.sh
Last active August 29, 2021 12:00
Shell script to regenerate debian changelog from git log
#!/bin/sh
sudo apt-get install -y moreutils git-buildpackage
>debian/changelog
prevtag=initial
pkgname=`cat debian/control | grep '^Package: ' | sed 's/^Package: //'`
git tag -l v* | sort -V | while read tag; do
(echo "$pkgname (${tag#v}) unstable; urgency=low\n"; git log --pretty=format:' * %s' $prevtag..$tag; git log --pretty='format:%n%n -- %aN <%aE> %aD%n%n' $tag^..$tag) | cat - debian/changelog | sponge debian/changelog
prevtag=$tag
@leifg
leifg / Vagrantfile
Last active August 15, 2024 15:13
Add a second disk to system using vagrant
file_to_disk = './tmp/large_disk.vdi'
Vagrant::Config.run do |config|
config.vm.box = 'base'
config.vm.customize ['createhd', '--filename', file_to_disk, '--size', 500 * 1024]
config.vm.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
@jk
jk / README.md
Last active April 27, 2018 18:02
Behat + Mink + Selenium 2 Stack

Important files

Here you find the DSL language definition for your phrases you can use in .feature files:

  • features/bootstrap/FeatureContext.php inherits from
  • vendor/behat/mink-extension/Behat/MinkExtension/Context/MinkContext.php

Installation

With Homebrew that gets really easy:

@Kahn
Kahn / hostvars
Last active October 18, 2017 14:19
Working jinja template using Ansible hostvars
{% for host in groups['switches'] %}
define host {
use generic-switch
host_name {{ host }}
alias {{ hostvars[host]['label'] }}
address {{ host }}
hostgroups SWITCHES
contact_groups networkadmins
}
@Marko-M
Marko-M / gist:9588211
Last active September 12, 2018 10:06
Xdebug trace with ?XDEBUG_TRACE trigger
zend_extension=/usr/lib/php5/20121212/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.auto_trace=0
xdebug.trace_enable_trigger=1
xdebug.trace_format=0
xdebug.trace_output_name=trace.%R
xdebug.collect_params=1
@jstrassburg
jstrassburg / jetty.xml
Last active March 27, 2020 18:10
Solr Jetty Authorization
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- only the relevant addition is listed here -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">MySolrRealm</Set>
<Set name="config">
@Kartones
Kartones / postgres-cheatsheet.md
Last active November 15, 2024 21:14
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@mlconnor
mlconnor / tomcat_memory.md
Created September 17, 2014 13:57
Memory settings for Java JVM in Amazon Elastic Beanstalk

Elastic Beanstalk Java JVM Settings

Determining the right memory settings (MX & MS) for the JVM is not trivial. If you set memory too low then your machine will trash as it runs out and eventually crash. If you set it too high then other critical processes such as Apache or the OS itself may become memory starved and also cause crashes.

In general, I think it best to set the initial memory setting (MS) to be small, around 200M. The real variable we need to calculate is the limit we will place on JVM memory (MS).

In order to make this determination, we need to calculate a few things such as the memory that Apache and the Linux OS need to operate efficiently.

Apache Memory Needs