Skip to content

Instantly share code, notes, and snippets.

@oinopion
oinopion / read-access.sql
Created October 5, 2016 13:00
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@pbolduc
pbolduc / 1. Install Redis
Last active July 3, 2023 09:39 — forked from nghuuphuoc/1) Install
Install redis on CentOS 7
# see How to Install Redis Server on CentOS 7 - http://linoxide.com/storage/install-redis-server-centos-7/
# --- Compiling ---
$ yum install gcc make tcl
$ REDIS_VER=3.2.3
$ wget http://download.redis.io/releases/redis-$REDIS_VER.tar.gz
$ tar xzvf redis-$REDIS_VER.tar.gz
$ cd redis-$REDIS_VER
$ make
$ make test
@mlafeldt
mlafeldt / postmortem.md
Last active March 27, 2024 09:23
Example Postmortem from SRE book, pp. 487-491

Shakespeare Sonnet++ Postmortem (incident #465)

Date

2015-10-21

Authors

  • jennifer
  • martym
@dtomasi
dtomasi / default
Last active December 8, 2023 04:20
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@fbrnc
fbrnc / consumer.php
Last active February 13, 2023 11:25
AWS Kinesis Example for PHP (using the AWS SDK for PHP)
<?php
// curl -sS https://getcomposer.org/installer | php
// php composer.phar require aws/aws-sdk-php
// export AWS_ACCESS_KEY_ID=...
// export AWS_SECRET_ACCESS_KEY=...
$streamName = '<INSERT_YOUR_STREAMNAME_HERE>';
$numberOfRecordsPerBatch = 10000;
@mikob
mikob / AWS, ELB, CF and Let's Encrypt
Last active February 15, 2024 13:47
AWS, ELB, Let's Encrypt
Elastic Load Balancer, CloudFront and Let's Encrypt
@evantoli
evantoli / GitConfigHttpProxy.md
Last active April 26, 2024 17:21
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@bitkidd
bitkidd / deleting_tons_of_files_in_linux.md
Last active August 14, 2018 13:59
Deleting tons of files in Linux (Argument list too long)

If you’re trying to delete a very large number of files at one time (I deleted a directory with 485,000+ today), you will probably run into this error:

/bin/rm: Argument list too long.

The problem is that when you type something like “rm -rf ”, the “” is replaced with a list of every matching file, like “rm -rf file1 file2 file3 file4” and so on. There is a reletively small buffer of memory allocated to storing this list of arguments and if it is filled up, the shell will not execute the program. To get around this problem, a lot of people will use the find command to find every file and pass them one-by-one to the “rm” command like this:

find . -type f -exec rm -v {} \;

My problem is that I needed to delete 500,000 files and it was taking way too long.

@sdieunidou
sdieunidou / rabbitmq.txt
Created October 22, 2015 19:51
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@ziadoz
ziadoz / composer_path.json
Last active January 4, 2023 19:36
Composer Using Local Repositories and Branches
{
"repositories": [
{
"type": "path",
"url": "../relative/project/path"
}
],
"require": {
"${project}": "dev-${branch}"
}