How to change DNS on Mac OS X with a click

I needed to use particular dns and would change them quickly (with a click)
here is how i did it:
First, here command for make modification by terminal:
sudo networksetup -setdnsservers <networkservice> DNS1, DNS2, DNS3

How to obtain a list of your network services:
networksetup -listallnetworkservices
you will obtain outcome like below:
networklist
In my case i have to change Wi-fi dns, so (as example i’ve used Google dns 8.8.8.8 and 8.8.8.4 ), opening  terminal and running the following command , DNS will be changed:
“sudo networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.8.4”

But how to run it with a click ? using Apple script : open it and insert the following commands :
scriptdnsFirst row executes the command described above , while second line brings up a message that tells us that the command was executed (clearly is optional) .
After that save as application and work is ended; a click will be enough to change your dns
applicationHere is the result after clicking (you will be prompted for the root password )
dnsupdate
Looking Dns section we can see that they have been modified
dnsresults

Posted in Mac Os | Leave a comment

How to insert xdcc commands in Kvirc menu

I always used Mirc and its countless scripting functions for more than 10 years; this time I wanted to try Kvirc  scripting functions.
Idea is to create an handy menu on Kvirc in order to execute commands xdcc send # ( command used to download data) and xdcc list (command for obtain list from bots) from a menu, instead of writing it in chat – here’s how:
In Kvirc menu, select “Scripting” – “Edit Popups” (CTRL+Shift+P)
menukvirc
Since our command, will run in a channel, select “Channel” from the popup menu
channelkvirc
Now click with the right mouse button within the channel menu and choose where you want to place the new element; for example, I chose to put it as last, so I selected the last entry and I clicked “new item below”, which I called XdccSend – you can also enter a number in the entry icon to get an icon (optional)
textxdcc
Finally I set menu dialog (variables are more complicated than on Mirc) for Xdcc send
xdccsend
and for Xdcc List (much more easy)
xdcclist textxdcclist
The result: when you  join in a channel and click with the right button the bot from which you want to receive file, new entries will appear:
comandinelcanale
If you click  XdccSend will be asked to enter package number, so insert number and wait for your package.
npack
While if you click Xdcc List (after selecting your bot) will show you the xdcc list of packages contained in bot (if bot is enabled for it)
xdclistcommand
If you are not a newbie in IRC world , don’t need more info 🙂

 

Posted in Gnu-Linux, Mac Os, Tech news - tutorials, Windows | 10 Comments

Systemd Installation on Debian Wheezy

I wanted to try the “infamous” systemd on my Debian Wheezy: Let’s start with a refresh (being root)
apt-get update && apt-get upgrade

After that we can install systemd  – initially I’ve used version present in repository Wheezy/stable (44-11 + deb7u4)
apt-get install systemd systemd-sysv
systemd-warning
After writing the funny sentence,  installation is completed.

Now, we have to edit the grub to make sure that systemd will start without any problems:
nano /etc/default/grub
At the last row I added, (under the GRUB_CMDLINE_LINUX_DEFAULT section):
init=/bin/systemd

Then i have updated grub:
sudo update-grub2
After reboot, Systemd is perfectly working.

At that point I wanted to try also the latest systemd version present in backports repository (204-14 ~ bpo70 +1); so i’ve enabled backports repository
nano /etc/apt/sources.list
adding wheezy-backports repository in sources.list:
deb http://ftp.debian.org/debian/ wheezy-backports main contrib non-free

After saving, type:
apt-get update
finally we can install  systemd backports repository version(204-14~bpo70+1):
apt-get install -t wheezy-backports systemd systemd-sysv

After reboot will have systemd working; considerations: the system reboot seems to be, in my case, slightly faster.

Below some useful commands operating in Systemd:

systemctl
Show all active services

systemd-analyze
Prints the time spent in the kernel before userspace has been reached, the time spent in the initial RAM disk (initrd) before normal system userspace has been reached, and the time normal system userspace took to initialize. Note that these measurements simply measure the time passed up to the point where all system services have been spawned, but not necessarily until they fully finished initialization.
systemdanalyzesystemd-analyze blame
a list of all units running, sorted according to the time you have used the services. This information can be used to optimize startup times, for example we can disable startup of a service (systemctl disable foo service) that maybe we don’t need and that takes a long time to start.
Note that the result could be misleading; for example, the start time of a service might be slow simply because it waits for initialization of another service is complete.
systemdanalyzeblame
systemctl start foo.service
activate a service immediately (replace foo service with a real service)

systemctl stop foo.service
Disable a service immediately

systemctl restart foo.service
Restart a service

systemctl status foo.service
Check status of a service

systemctl enable foo.service
Enable a service to startup on boot

systemctl disable foo.service
Disable a service at boot

systemctl is-enabled foo.service; echo $?
Check whether a particular service or less at startup

Posted in Gnu-Linux | Leave a comment

How to save a list of installed packages (Debian)

May happen to have to re-install Debian (and derivates) in another pc/server
Certainly, if new machine has  a similar hardware i could clone hard disk; but more often the other machine has a different hardware…
So it is useful to save a list of installed packages; to have them immediately available during reinstallation in another (or in same) machine avoiding to remember  all packages one by one 🙂
As first thing is useful to make a copy of /etc/apt/sources.list or annotate  repository are you using   (wheezy, backports, etc) somewhere.

Open terminal (being root) and type:
dpkg –get-selections > /home/$USER/pacchetti.txt
pacchetti

At this way was created a file named “pacchetti.txt” in my  /home directory;
now you can save your file somewhere; for example, in an external usb drive,so you can use it when you’ll
need.

How to restore packages:
Place file pacchetti.txt in your /home , then select packages in your file by typing:
sudo dpkg –set-selections < /home/$USER/pacchetti.txt      
and install selected packages by typing  :
sudo apt-get dselect-upgrade
pacchetti2  Selected packages will be installed (obviously if missing). 

Posted in Gnu-Linux | Leave a comment