grep --color='auto' -P -n "[\x80-\xFF]" textfile
Thursday, March 23, 2023
Tuesday, June 2, 2020
Split a PDF file into multiple pages
If you ever needed to split a PDF file into separate PDF documents, say when someone sent you a PDF file with details for one customer on pages 1-2, and the next one from 3-4 etc. There is a quick and easy way under Ubuntu.
We will need to install qpdf first.
After which we can use the program to extract and create the PDF documents for us.
This will use the infile.pdf as source and output PDF files as outfile-001-002.pdf, outfile-003-004.pdf...
We will need to install qpdf first.
sudo apt install qpdf
After which we can use the program to extract and create the PDF documents for us.
qpdf --split-pages=2 infile.pdf outfile.pdf
This will use the infile.pdf as source and output PDF files as outfile-001-002.pdf, outfile-003-004.pdf...
Saturday, October 17, 2015
LibreSWAN setup for heavy usage
After setting up libreswan you might find that the tunnel disconnects when there is a lot of sessions. On the libreswan machine, if you try and ping a host on the other side of the tunnel you get the following:
connect: No buffer space available
This is caused by the xfm_gc_thresh setting being too low. This controls the size of the IPSEC routing table and when the limit is reached the table is cleaned up which removes information related to active connections. You can verify the value by doing the following:
cat /proc/sys/net/ipv4/xfrm4_gc_thresh
1024
If you get a low value like 1024 you will have the problem. Increase the value:
sysctl -w net.ipv4.xfrm4_gc_thresh=32768
sysctl -p
Add the setting in /etc/sysctl.conf to make it permanent
net.ipv4.xfrm4_gc_thresh = 32768
connect: No buffer space available
This is caused by the xfm_gc_thresh setting being too low. This controls the size of the IPSEC routing table and when the limit is reached the table is cleaned up which removes information related to active connections. You can verify the value by doing the following:
cat /proc/sys/net/ipv4/xfrm4_gc_thresh
1024
If you get a low value like 1024 you will have the problem. Increase the value:
sysctl -w net.ipv4.xfrm4_gc_thresh=32768
sysctl -p
Add the setting in /etc/sysctl.conf to make it permanent
net.ipv4.xfrm4_gc_thresh = 32768
Friday, May 8, 2015
ICINGA2: Disable ping check for hosts
Sometimes you need to monitor services on a server where ICMP is not feasible to check whether the host is up. In Icinga2, even if you change your host definition to use
check_command = "dummy"
it will still do a ping4 service check on the host. The issue is with the definition of the ping4 service as it will apply the ping4 service checks to all hosts that have "address" set.
One of the ways to bypass this is to change the ping4 service line to the following:
assign where host.address && host.vars.ping == "yes"
This way we can add a variable to only allow certain hosts to be pinged. This solution will force you to add the variable
vars.ping = "yes"
for every host you want checked via the ping4 service. An easier way is to modify the generic-host template to include the vars.ping = "yes" variable. You also need to create another template let us say generic-host-no-ping to not have the variable set to "yes" and to use the "dummy" check service which will always return 0 (OK)
for every host you want checked via the ping4 service. An easier way is to modify the generic-host template to include the vars.ping = "yes" variable. You also need to create another template let us say generic-host-no-ping to not have the variable set to "yes" and to use the "dummy" check service which will always return 0 (OK)
template Host "generic-host-no-ping" {
max_check_attempts = 5
check_interval = 1m
retry_interval = 30s
check_command = "dummy"
vars.ping = "no"
}
Now when you create your host definition you just need to import the correct template.
Saturday, April 6, 2013
Using DELL SUU 7.2 on Centos 6.4
After readming through a couple of posts and blogs on how to use SUU on CentOS the following worked for me.
Please note that if you do not have the right rpm's installed the update process will delete your /tmp directory, so try this on a non production server first.
Install the relevant rpms:
yum -y install glibc.i686 compat-libstdc++-33.i686 libstdc++.i686 zlib.i686 libxml2.i686 libXp.i686 libXtst.i686 ncurses-libs pam.i686 ncurses-libs.i686 compat-libstdc++-296
Mount the ISO image or dvd and run the following from the mountpoint
./suu -c (check if there are any updates)
./suu -u (update)
you can do a tail -f /var/log/dell/suu/* to see what is happening.
Please note that if you do not have the right rpm's installed the update process will delete your /tmp directory, so try this on a non production server first.
Install the relevant rpms:
yum -y install glibc.i686 compat-libstdc++-33.i686 libstdc++.i686 zlib.i686 libxml2.i686 libXp.i686 libXtst.i686 ncurses-libs pam.i686 ncurses-libs.i686 compat-libstdc++-296
Mount the ISO image or dvd and run the following from the mountpoint
./suu -c (check if there are any updates)
./suu -u (update)
you can do a tail -f /var/log/dell/suu/* to see what is happening.
Wednesday, October 12, 2011
Windows 8 UI
Read the post from Microsoft on the feedback they had for the Windows 8 pre-release. They keep missing the point. The user experience should be the key focus, not trying to fit the tablet experience to the desktop experience. One of the reasons people are moving to Apple products is the user experience. Windows 8 should not force a context switch when you try and use the product.
Compare the following, how does the start screen differ?
Compare the following, how does the start screen differ?
Saturday, October 23, 2010
Tech-Ed Africa 2010
If you ever have the opportunity to see Andy Malone speak on security, do so. Well worth the effort.
Subscribe to:
Posts (Atom)