Skip to content

Instantly share code, notes, and snippets.

@mortenbra
mortenbra / vscode_run_sqlplus.bat
Last active March 19, 2017 20:45
Batch script to run sqlplus from VS Code for Windows
rem Setup sqlplus environment for Unicode
rem Run this before running scripts that contain multibyte characters
rem See http://www.sqlsnippets.com/en/topic-13434.html for details
set NLS_LANG=.AL32UTF8
chcp 65001
rem show raw error messages from sqlplus
rem echo exit | echo show errors | sqlplus %1 %2
rem get errors that can be parsed with problemMatcher
@mortenbra
mortenbra / letsencrypt.sh
Last active January 16, 2020 11:43
Simple shell script for LetsEncrypt, based on https://calomel.org/lets_encrypt_client.html
#!/bin/bash
# shell script hardening
set -euf -o pipefail
#
# Lets Encrypt Certificate Generator
# https://calomel.org/lets_encrypt_client.html
# lets_encrypt.sh v0.07
#
@mortenbra
mortenbra / scp_copy_folder.sh
Created July 22, 2015 11:40
Use SCP to copy entire folder to remote host
# copy entire folder to remote host
scp -P 22 -r my_local_folder username@hostname:/var/www/html/c/my_remote_folder
@mortenbra
mortenbra / centos_node_install.sh
Created July 17, 2015 07:36
Install node.js and node package manager (npm) on CentOS
# install node.js on CentOS
# see https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-a-centos-7-server
# install EPEL (Extra Packages for Enterprise Linux) repository
yum install epel-release -y
# install node
yum install nodejs -y
# install node package manager (NPM)
@mortenbra
mortenbra / ords_jdbc_config.xml
Created July 16, 2015 22:10
ORDS configuration for JDBC connection pool (default pool is too small)
<entry key="jdbc.InitialLimit">10</entry>
<entry key="jdbc.MinLimit">10</entry>
<entry key="jdbc.MaxLimit">60</entry>
@mortenbra
mortenbra / centos_tmpfs.sh
Created July 15, 2015 08:36
Adjusting tmpfs size for Oracle XE on CentOS
# adjust tmpfs on CentOS as appropriate for Oracle XE
# see https://oracle-base.com/articles/11g/automatic-memory-management-11gr1
# check the available space
df -k
# adjust available space
umount tmpfs
mount -t tmpfs shmfs -o size=1024M /dev/shm
@mortenbra
mortenbra / centos_yum_cron.sh
Created July 14, 2015 07:12
Set up yum-cron for automatic updates on CentOS
# see http://linuxaria.com/pills/enabling-automatic-updates-in-centos-6-and-red-hat-6
# install yum-cron
yum install yum-cron -y
# if desired, set up admin email for notifications
# look for the MAILTO option
nano /etc/sysconfig/yum-cron
# enable automatic updates
@mortenbra
mortenbra / apache_ssl_install.sh
Created July 13, 2015 20:00
Install mod_ssl and set up self-signed certificate on Apache on CentOS
# install mod_ssl and set up self-signed certificate on Apache on CentOS
# install mod_ssl
yum install mod_ssl -y
# directory to store keys and certificates
mkdir /etc/httpd/ssl
# create server key and self-signed certificate
# you will be prompted for certificate information
@mortenbra
mortenbra / apache_copy_homepage.sh
Created July 13, 2015 19:29
Copy new homepage to Apache web server
# copy files from client to server
# adjust SSH port number, file paths, server/host name as appropriate
cd /users/yourname/projectname/website
scp -P 22 index.html root@server-name-or-ip:/var/www/html/
@mortenbra
mortenbra / oracle_network_acl_config.sql
Last active October 30, 2015 13:45
Oracle Network ACL configuration
-- to be run as user SYS
-- to avoid ORA-30992 and ORA-01858 due to invalid date format when calling create_acl
alter session set nls_language = AMERICAN;
alter session set nls_territory = AMERICA;
BEGIN
DBMS_NETWORK_ACL_ADMIN.create_acl (
acl => 'apex.xml',
description => 'Access Control List for APEX',