Skip to content

Instantly share code, notes, and snippets.

@vinayakrk
vinayakrk / Sparsify TrueNAS VM disk.md
Created September 14, 2023 10:46
Make Truenas VM disk sparse allocation

Create the VM as normal.

After creation go to portal and find the path for the zvol e.g.: nvme1/vmdisks/awx-wsh01 or nvme1/vmdisks/ol8vm1-ci39z

Login as root on the TRUENAS console (or run with sudo when logged in as admin)

root@tnas1[~]# zfs get refreservation nvme1/vmdisks/awx-wsh01       
NAME                     PROPERTY        VALUE      SOURCE
@vinayakrk
vinayakrk / repo_setup.sh
Created September 13, 2023 21:31
Create a local RPM repository setup for Oracle Linux 8
#!/bin/bash
#
# This is a script following the instructions defined by Tim's instructions from below
# https://oracle-base.com/articles/linux/create-a-local-yum-repository-for-oracle-linux-8
#
set -eau
if [[ $EUID -ne 0 ]]; then
echo "Script must be run as root"

Configure systemd-resolved to use a specific DNS nameserver for a given domain

Use case

Given

  • I use a VPN to connect to my work network
  • I'm on a Linux computer that uses systemd-resolved
  • I have a work domain called example.com
  • example.com is hosted by both public and private DNS nameservers
# If Debian 11 is ran on a LXC container (Proxmox), SSH login and sudo actions can be slow
# Check if in /var/log/auth.log the following messages
Failed to activate service 'org.freedesktop.login1': timed out (service_start_timeout=25000ms)
-> Run systemctl mask systemd-logind
-> Run pam-auth-update (and deselect Register user sessions in the systemd control group hierarchy)
@vinayakrk
vinayakrk / linkedin-ublock.txt
Created June 22, 2022 19:28
linkedin ublock custom filter
linkedin.com#?#.feed-shared-update:-abp-contains(Promoted)
linkedin.com##.ad-banner
linkedin.com#?#.feed-shared-update-v2:-abp-contains(Promoted)
linkedin.com##iframe[src=”about:blank”]
create or replace trigger block_grants before grant on database
declare
begin
raise_application_error(-20001,'No grant for you');
end;
/
aahs
abbe
abbr
abed
abet
able
ably
abut
acct
aced
@vinayakrk
vinayakrk / forward_listener_demo.txt
Last active March 1, 2022 17:07
FORWARD_LISTENER demo steps
# Prepare source database
export ORACLE_SID=cdb1
export ORAENV_ASK=NO
. oraenv -s
/orasoft/scripts/fix-listener.sh
lsnrctl start
/orasoft/scripts/renamedb.sh cdb1 oldcdb1
@vinayakrk
vinayakrk / gg.sql
Created July 13, 2021 01:42
Goldengate pre-requisites
shutdown immediate
startup mount;
alter database archivelog;
alter database open;
alter database force logging;
alter database add supplemental log data;
alter system set enable_goldengate_replication=true;
create user appuser identified by appuser default tablespace users quota unlimited on users;
grant create session, resource to appuser;
#!/bin/bash
# single thread
LOCKF=/tmp/demo.lck
exec 99> "$LOCKF"
if ! flock -n 99 ; then
echo "Already running"
exit 1
fi