Skip to content

Instantly share code, notes, and snippets.

@todgru
todgru / aws-ec2-redis-cli.md
Created June 12, 2014 23:01
AWS redis-cli on EC2
@JonathanMH
JonathanMH / create-conflict.sh
Created June 24, 2015 09:05
Create a merge conflict in git
#!/bin/bash
mkdir git-repo
cd git-repo
git init
touch my_code.sh
git add my_code.sh
echo "echo Hello" > my_code.sh
git commit -am 'initial'
git checkout -b new_branch
echo "echo \"Hello World\"" > my_code.sh
@daspecster
daspecster / install-docker-compose.sh
Last active October 11, 2018 06:52
Centos 7 docker compose install from scratch
#!/bin/bash
sudo yum update -y
sudo yum install -y netstat git rubygems gcc kernel-devel make perl
sudo yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel maven
sudo gem install sass
cd /tmp
@alferov
alferov / docker-rm-images.md
Last active July 24, 2023 08:33
Remove all (untagged) images and containers from Docker
# Delete all containers
docker rm $(docker ps -aq)
# Delete all images
docker rmi $(docker images -q)
# Delete all untagged images
docker rmi $(docker images -q --filter "dangling=true")

References:

@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;
@mmasashi
mmasashi / creaet_read_only_user.sql
Created November 14, 2016 20:24
Create read-only user on MySQL
CREATE USER r_only_user identified by 'password';
GRANT SELECT, SHOW VIEW, PROCESS, REPLICATION CLIENT ON *.* TO 'r_only_user'@'%' IDENTIFIED BY 'password';
GRANT SELECT, SHOW VIEW, PROCESS, REPLICATION CLIENT ON *.* TO 'r_only_user'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
@alibo
alibo / s3-slack-notifier-lambda.js
Created February 20, 2017 20:52
Send S3 events to s slack channel via Lambda and Node.js
'use strict';
/*
Thanks to https://gist.github.com/vgeshel/1dba698aed9e8b39a464
*/
console.log('Loading function');
const aws = require('aws-sdk');
const s3 = new aws.S3({ apiVersion: '2006-03-01' });
@ndaidong
ndaidong / install-node.sh
Last active April 23, 2021 10:58
Install Node.js on Endeavour, Debian, Fedora without building
#!/bin/bash
export NODE_VERSION=14.16.1
export NODE_DOWNLOAD_URL=https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz
export NODE_INSTALL=/opt/node
export PATH=$NODE_INSTALL/bin:$PATH
sudo mkdir $NODE_INSTALL
sudo chown -R ${USER} $NODE_INSTALL
@dasgoll
dasgoll / gist:d4587fc8c3c88008bdd41b56c001df73
Created April 12, 2018 13:08
Install Sensu on Amazon Linux
echo '
[sensu]
name=sensu
baseurl=https://sensu.global.ssl.fastly.net/yum/6/x86_64/
gpgcheck=0
enabled=1
' | tee -a /etc/yum.repos.d/sensu.repo
apiVersion: v1
kind: Pod
metadata:
name: {{ .Release.Name }}-post-upgrade-hook
labels:
app.kubernetes.io/name: {{ .Release.Name }}
annotations:
"helm.sh/hook": "post-upgrade"
"helm.sh/hook-delete-policy": "hook-succeeded"
"sidecar.istio.io/inject": "false"