Skip to content

Instantly share code, notes, and snippets.

View D4R4's full-sized avatar

Dara Ardalan D4R4

  • SCALINX
  • Paris, France
View GitHub Profile
@D4R4
D4R4 / RIPE_ptr_updaterecord
Last active September 5, 2019 07:45
This is the custom API format that must be submitted as the parameter for RIPE Web LIR Portal to request a new PTR data customization
domain: 112.249.80.in-addr.arpa
nserver: ns1.ptco.net
nserver: ns2.ptco.net
admin-c: PA8872-RIPE
tech-c: PA8872-RIPE
zone-c: PA8872-RIPE
mnt-by: ir-ptcopjs-1-mnt
created: 2019-05-15T06:00:50Z
last-modified: 2019-05-15T06:00:50Z
source: RIPE
@D4R4
D4R4 / parity_initialization_check
Created May 29, 2019 08:47
Checking parity initialization with ssacli tool
./ssacli ctrl slot=0 logicaldrive 1 show
Unix systems provide the chroot command which allows you to reset the / of the user to some directory in the filesystem hierarchy, where they cannot access "higher-up" files and directories.
However in your case, it would appropriate to provide a virtual chroot implemented by the remote shell service. sftp can be easily configured to restrict a local user to a specific subset of the filesystem.
hence in your case, you want to chroot let's say, user foo user into the /var/www/vhosts/ directory.
You can set a chroot directory for your user to confine them to the subdirectory /var/www/vhosts/ like so in /etc/ssh/sshd_config;
Create user foo with password
@D4R4
D4R4 / sshfs_fstab_key
Created June 2, 2019 09:32
Mount SSHFS volumes in fstab with ssh key, change USER, path UID and GUID
sshfs#[email protected]:/data/www /mnt/logs/ fuse IdentityFile=/home/USER/.ssh/id_rsa,uid=UID,gid=GUID,users,idmap=user,noatime,allow_other,_netdev,reconnect,ro 0 0
@D4R4
D4R4 / smsir_template.php
Created June 3, 2019 12:11
sms..ir template code example
<?php
class SmsIR_UltraFastSend {
/**
* gets API Ultra Fast Send Url.
*
* @return string Indicates the Url
@D4R4
D4R4 / vcenter-host-backup.ps1
Last active September 5, 2019 07:43
This creates a backup from ESXi host configuration profile in tgz (?) format
$VCUSER = "qweqwe" #$Parameters.Get_Item("VCUSER")
$VCPASS = "qweqwe"#$Parameters.Get_Item("VCPASS")
$VCNAME = "qweqwe" #$Parameters.Get_Item("VCNAME")
Describe "Checking PowerCLI Cmdlets available" {
$cmdletname = "Connect-VIServer"
It "Checking $cmdletname is available" {
$command = Get-Command $cmdletname
$command | Select Name, Version
$command.Name| Should Be $cmdletname
@D4R4
D4R4 / vcenter-host-restore.ps1
Last active September 5, 2019 07:43
This restores a backup from an ESXi host configuration profile local folder
$VCUSER = "qweqwe" #$Parameters.Get_Item("VCUSER")
$VCPASS = "qweqwe"#$Parameters.Get_Item("VCPASS")
$VCNAME = "qweqwe" #$Parameters.Get_Item("VCNAME")
Describe "Checking PowerCLI Cmdlets available" {
$cmdletname = "Connect-VIServer"
It "Checking $cmdletname is available" {
$command = Get-Command $cmdletname
$command | Select Name, Version
$command.Name| Should Be $cmdletname
@D4R4
D4R4 / linux-multiple-routing-tables
Last active November 11, 2019 09:10
Running multiple IPs in linux with seperate gateway and networks, without the use of rp_filter
sudo ip route add 192.168.0.0/24 dev ens192 tab 1
sudo ip route add 192.168.1.0/24 dev ens224 tab 2
sudo ip route add default via 192.168.0.1 dev ens192 tab 1
sudo ip route add default via 192.168.1.1 dev ens224 tab 2
sudo ip rule add from 192.168.0.10/32 tab 1 priority 100
sudo ip rule add from 192.168.1.10/32 tab 2 priority 200
sudo ip route flush cache
@D4R4
D4R4 / downgrade-ubuntu
Created June 17, 2019 13:59
Downgrade Ubuntu 18.10 to 18.04
1. Downgrade sources.list
$ sudo sed -i 's/cosmic/bionic/g' /etc/apt/sources.list
2. Pin packages
/etc/apt/preferences
Package: *
Pin: release a=bionic
Pin-Priority: 1001
3. Downgrade Ubuntu system
@D4R4
D4R4 / disable-selinux
Created June 18, 2019 08:57
Disable SELinux in CentOS 7.x
sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config