The Archives

  • 12.16.08
    TTYtter: twitter client for real commandliners scripts, shell | rafacas | (2)
    If you are a twitter adict (I know you are already a commandliner ;) TTYtter is your client. TTYtter requires only Perl 5.005 or better, and either cURL or Lynx. It supports encryption as long as your Lynx or cURL does. If your client supports it you can configure TTYtter to use SSL changing the relevant URLs. These can be changed using TTYter options (-url, -rurl, -uurl, -wurl, -update, -dmurl and -frurl) or you can cut and paste the following code into your .ttytterrc file in your $HOME directory: url=https://twitter.com/statuses/friends_timeline.json rurl=https://twitter.com/statuses/replies.json uurl=https://twitter.com/statuses/user_timeline wurl=https://twitter.com/users/show update=https://twitter.com/statuses/update.json dmurl=https://twitter.com/direct_messages.json frurl=https://twitter.com/friendships/exists.json The default cURL's certificate bundle is old and may not support Twitter's current ...
  • 12.08.08
    Ctrl-X-E shell | n0str0m0 | (0)
    With this keystroke combination, you open the editor specified by the $EDITOR variable (or emacs if the variable is not set). Once you write the file and quit, bash will execute the commands written in the editor. This is especially useful when you want to write a small script.
  • 11.15.08
    Strings in bash shell | pfortuny | (0)
    Start with a string: $ a="hi, this is my beautifull string" Positional substrings: Substring from the 4th character on: $ echo ${a:3} this is my beautifull string Substring of length 4 from the 10th character: $ echo ${a:9:4} is m Substring modification: Substitute the first instance of a substring: $ echo ${a/full/ful} hi, this is my beautiful string Same example: $ echo ${a/h/H} Hi, this is my beautifull string Substitute all the instances of a substring: $ echo ${a//hi/HI} HI, tHIs is my beautifull string Substring removal: Remove the shortest match of a substring from the start: $ echo ${a#h*i} , this is my beautifull string Same, starting at the end $ echo ${a%i*g} hi, this is my beautifull str Remove the longest match of a ...
  • 07.17.08
    Roll the dice scripts | n0str0m0 | (5)
    Not a command, but a fun thing anyway. What if you need a dice (as I needed the other day while trying to play a game with my friends) and you don't have one? Bash can do it: $ while true;do let dice="$RANDOM % 6"; let dice=$dice+1;echo $dice;read;clear;done Though it's a long line, this is just an infinite loop in which we use the $RANDOM bash variable which generates a random number between 0 and 32767. After that, we divide it by 6 and take the remainder (so we have a number between 0 and 5) and add 1 to shift the interval ...
  • 06.15.08
    More on bash history shell | n0str0m0 | (2)
    Bash provides a powerful history system that helps you in repeating commands and arguments. For example, the !! command, repeats the last executed command. If you want to execute a command typed before the last one, you can select it with the following: !-number Something like this: $ ls $ ps $ !-2 The last command executes ls again. In addition, you can specify previous arguments too. This is done with the !:n command (n being a number). Let's see an example: $ less file.txt $ cp !:1 file_copy.txt The last command takes the first argument of the previous executed command and makes a copy with a different name. If this is not ...