Skip to content

Instantly share code, notes, and snippets.

@ivmm
ivmm / litespeed.repo
Created August 12, 2017 09:34
OSS加速litespeed源
[litespeed]
name=LiteSpeed Tech Repository for CentOS $releasever - $basearch
baseurl=http://openlitespeed.oss-cn-hangzhou.aliyuncs.com/centos/7/$basearch/
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://openlitespeed.oss-cn-hangzhou.aliyuncs.com/centos/RPM-GPG-KEY-litespeed
[litespeed-update]
name=LiteSpeed Tech Repository for CentOS $releasever - $basearch
@ivmm
ivmm / nginx
Created September 20, 2017 07:15
Nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@ivmm
ivmm / nginx.conf
Created September 20, 2017 07:17
nginx.conf
user www-data;
worker_processes auto;
error_log /data/wwwlogs/error_nginx.log crit;
pid /run/nginx.pid;
worker_rlimit_nofile 51200;
events {
use epoll;
worker_connections 51200;
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@ivmm
ivmm / redistest.php
Created March 17, 2019 13:48
redistest.php
<?php
//simple counter to test sessions. should increment on each page reload.
session_start();
$count = isset($_SESSION['count']) ? $_SESSION['count'] : 1;
echo $count;
$_SESSION['count'] = ++$count;
@ivmm
ivmm / alinux-2.1903-plus.repo
Created May 2, 2019 03:43
alinux-2.1903-plus.repo
[plus]
name=Alibaba Cloud Linux 2.1903 Plus Software Collections
baseurl=http://mirrors.aliyun.com/alinux/2.1903/plus/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/alinux/RPM-GPG-KEY-ALIYUN
@ivmm
ivmm / decloudify_image
Created May 9, 2019 07:10 — forked from remoteur/decloudify_image
decloudify_image
yum install -y libguestfs-tools
virt-filesystems --long -h --all -a rhev-m.init.qcow2
truncate -r rhev-m.init.qcow2 rhev-m.qcow2
truncate -s +100G rhev-m.qcow2
virt-resize --expand /dev/sda1 rhev-m.init.qcow2 rhev-m.qcow2
virt-customize -a rhev-m.qcow2 --root-password password:<pass>
virt-customize -a rhev-m.qcow2 --run-command 'yum remove -y cloud-init'
virt-customize -a rhev-m.qcow2 --run-command 'sed -i s/^PasswordAuthentication.*/PasswordAuthentication\ yes/ /etc/ssh/sshd_config'
virt-customize -a rhev-m.qcow2 --run-command 'sed -i s/^PermitRootLogin.*/PermitRootLogin\ yes/ /etc/ssh/sshd_config'
@ivmm
ivmm / nginx.repo
Created May 26, 2019 06:39
nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
@ivmm
ivmm / create-swap.sh
Last active May 26, 2019 10:06
create-swap.sh
#!/bin/sh
# Checking if user is root otherwise throw error
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
# Availbale Options
if [ ! "$#" -ge 1 ]; then
@ivmm
ivmm / MariaDB.repo
Created May 27, 2019 15:17
MariaDB.repo
# MariaDB 10.4 RedHat repository list - created 2019-05-27 11:58 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/rhel8-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
enabled=1
gpgcheck=1