Showing posts with label stupid debian tricks. Show all posts
Showing posts with label stupid debian tricks. Show all posts

Friday, December 19, 2008

Stupid nix trix: Making awful noises, or testing your speakers in linux

Because everything in linux / Unix / MacOS X is a file, you can do some interesting things with devices, like send data straight to them. Your sound card is typicaly denoted by /dev/dsp. There is another file that is a (pseudo)random number generator and it is /dev/random or /dev/urandom. There is also a program that has a primary purpose of the low-level copying and conversion of raw data. So you can pipe garbage to your soundcard with this:

dd if=/dev/urandom of=/dev/dsp
or
sudo dd if=/dev/urandom of=/dev/dsp

This will work in cygwin as well.

Saturday, December 13, 2008

stupid nix trix: simple stupid ssh piping

I am going to start a feature called stupid nix trix, that will be one liner helpful commands that you can do on *nix ( unix, linux, mac ) machines.

So let's say you have a file on your home nix machine and you need it on your server, well if ssh is enabled on that server you don't need to break open filezilla just to sftp that file across, you can do it in one line:

Hypothetical:
cat /orignalDir/filename | ssh usernameforserver@server.tld "cat > /destinationDir/filename"

Real World:
cat $HOME/.ssh/id_rsa.pub | ssh root@irc.9unk0r.com "cat > /tmp/id_rsa.pub"

Monday, November 10, 2008

Poor man's firewall ( debian )

This will work on must linux based systems I imagine. It is blocking an IP, by routing all responses through 127.0.0.1. So instead of sending the response packets it just eats them. This is done by adding a static route which directs the traffic no where.

route add -host 1.1.1.1 netmask 0.0.0.0 lo

Ok so in this example, replace 1.1.1.1 with the offending IP. You can do the same thing with FreeBSD but it's a little different and IMHO makes more sense. I will post that solution later.


This is a quick and dirty solution...never use this as a permanent firewall.