Skip to content

Instantly share code, notes, and snippets.

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate]
"ElevateNonAdmins"=dword:00000001
"WUServer"="http://192.168.8.53:8530"
"WUStatusServer"="http://192.168.8.53:8530"
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]
"NoAutoUpdate"=dword:00000000
"AUOptions"=dword:00000003
@faizal2007
faizal2007 / xen-conf-window
Last active October 25, 2023 08:08
Xen config using iso
# The MIT License (MIT)
# Copyright © 2023 Faizal Sadri
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
@faizal2007
faizal2007 / basic_firewall.sh
Created April 27, 2021 01:21
Basic firewall only block incoming access
#!/bin/bash
# My system IP/set ip address of server
PUBLIC_PORT=(22 80)
# comment this to disable
ENABLE_PRIVATE=1
##
# $PRIVATE_PORT must have the same array lenght
# with PRIVATE_IP
@faizal2007
faizal2007 / check_port.sh
Created April 26, 2021 23:30
Check open open
#!/bin/bash
CMD="$(dirname $0)/$(basename $0)"
if [ $# -ne 2 ]; then
echo "${CMD} <ip> <port>"
else
echo > /dev/tcp/$1/$2 && echo "open"
fi
#echo > /dev/tcp/192.168.1.41/9100 && echo "open"
@faizal2007
faizal2007 / lv-snapshot.sh
Created April 24, 2021 16:44
Archive snapshot and delete old copy
#!/bin/bash
VG_GROUP=geekha
LV_NAME=www1-disk
DATE="$(date +%Y_%m_%d-%H%M)"
LV_TAG=snapshot
SIZE=20G
# retention copy
COPY=3
lvcreate -L$SIZE -s -n $LV_NAME-$LV_TAG-$DATE /dev/$VG_GROUP/$LV_NAME
@faizal2007
faizal2007 / postgres_queries_and_commands.sql
Created April 10, 2021 04:47 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@faizal2007
faizal2007 / iptables-nat-multiport.sh
Last active April 12, 2021 08:37
Port forwarding for incoming port using iptables
#!/bin/bash
# The MIT License (MIT)
#
# Copyright (c) 2016 Faizal Sadri
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@faizal2007
faizal2007 / example.com.conf
Last active June 26, 2021 11:45
Bind9 basic config
; create file in /var/named/example.com
; example.com
$TTL 3600
example.com. IN SOA ns1.example.com. dnsmaster@example.com. (
2021062601 ; Serial
3H ; refresh after 3 hours
1H ; retry after 1 hour
1W ; expire after 1 week
1D) ; minimum TTL of 1 day
@faizal2007
faizal2007 / redmine_notes
Last active March 26, 2020 11:29
redmine installation notes
#Install plugin
bundle config set without 'development test'
bundle config set path 'vendor/bundle'
bundle install
bundle exec rake redmine:plugins NAME=redmine_checklists RAILS_ENV=production
touch tmp/restart.txt
@faizal2007
faizal2007 / getuserowncloud.sh
Created March 21, 2020 10:15
bash iterate jason data from owncloud occ
sudo -u www-data /usr/bin/php -f /var/www/html/owncloud/occ user:list --output=json --attributes=uid | jq 'del(.freakie)' | jq -r 'keys | .[]'