14 November 2010

OpenDNS - Treoir Gearr do Usáideorí Debian


OpenDNS - Treoir Gearr do Usáideorí Debian

OpenDNS - Quick Start for Debian Users

Tá na treoracha seo níos giorra ná na cinn Gentoo.De gnáth, caithfidh tú /etc/resolv.conf a chur in eagar, agus deimhnigh ní athróidh rud ar bith é. Ach tá muid ábalta an stuif sin a fhágáil ar lar mar bheidh muid ag suiteáil pdnsd mar taisc DNS. Nuair a shuiteálann Debian pdnsd, déanann sé an stuif eile sin.

These instructions are a lot shorter than the ones for Gentoo users. Normally you would have to edit /etc/resolv.conf, and make sure that nothing will overwrite your changes. However, we can skip all that because if you're using OpenDNS, you'll probably want a local DNS cache so your computer doesn't have to go back to OpenDNS for subsequent queries. I used pdnsd. When Debian installs pdnsd, it does that other stuff for us.

1. Suiteáil pdnsd.

1. Install pdnsd.

aptitude install pdnsd

Roghnaigh "manual" mar "pdnsd configuration method".

When asked to select the pdnsd configuration method, choose "manual".

2. Cumraigh pdnsd.

2. Configure pdnsd.

Cuir an roinn "server" in eagair mar an sampla seo a leanas. Scrios an /* roimhe sin agus an */ ina dhiaidh sin.

Edit the "server" section in /etc/pdnsd.conf, following the example below. Be sure to uncomment it by removing the /* before and the */ after it.

server {
label = "root-servers";
root_server=on;
ip =  208.67.222.222
, 208.67.220.220
;
timeout = 5;
uptest = query;
interval = 30m;      // Test every half hour.
ping_timeout = 300;  // 30 seconds.
purge_cache = off;
exclude = .localdomain;
policy = included;
preset = off;
}

3. Tosaigh pdnsd.

3. Start pdnsd.

/etc/init.d/pdnsd start

Má bhfaigheann tú teachtaireacht mar "Could not bind tcp socket: Address already in use", b'fheidir go bhfuil named ag rith. Stop é le killall named.

If you get messages such as "Could not bind tcp socket: Address already in use", you might have named running. Stop it with killall named.

4. Deimhnigh go feidhmíonn sé le ceist úr.

4. Verify that it works for fresh queries.

dig www.opendns.com

Seo toradh ceart:

The result should look like this:

; <<>> DiG 9.4.2-P2 <<>> www.opendns.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7419 
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0  

;; QUESTION SECTION: 
;www.opendns.com.               IN      A  

;; ANSWER SECTION: 
www.opendns.com.        30      IN      A       208.67.219.101  

;; Query time: 927 msec 
;; SERVER: 208.67.220.220#53(208.67.220.220) <-- OpenDNS server
;; WHEN: Sat Nov 15 18:46:44 2008 
;; MSG SIZE  rcvd: 49  

5. Deimhnigh go úsáidtear sonraí thaiscthe le hathceist.

5. Verify that it uses cached data for repeated queries.

Eisigh an ceist céanna dig (dig www.opendns.com) faoi dhó, agus breathnaigh ar an líne ;; Query time:. An darna uair ba cheart do beagnach ar an toirt mar tá an eolas sa taisc cheana féin.

Run the same dig query (dig www.opendns.com) again, and look for the ;; Query time: line. The second time it should be nearly instantaneous because the information is already in the cache.

13 November 2010

Blúire Téacs ar Linux, le feidhmchlár ar bith

Seo cúpla script a dhéanamh blúire téacs ar Linux, le feidhmchlár ar bith. Ní gá leat ach ceann amháin acu. Léigh na nótaí tráchta le roghnaigh.
Here are a couple of scripts that implement text snippets in Linux, in any application. You only need one of them. Read the comments to decide which is best for you.

snippy
#!/bin/bash
#
# Based on "snippy" by "sessy" 
# (https://bbs.archlinux.org/viewtopic.php?id=71938)
#
# You will also need "dmenu", "xsel" and "xdotool". Get them from your linux
# distro in the usual way.
#
# To use:
# 1. Create the directory ~/.snippy
#
# 2. Create a file in that directory for each snippet that you want.
#    The filename will be used as a menu item, so you might want to
#    omit the file extension when you name the file. 
#
#    TIP: If you have a lot of snippets, you can organise them into 
#    subdirectories under ~/.snippy.
#
#    TIP: The contents of the file will be pasted asis, so if you 
#    don't want a newline at the end when the text is pasted, don't
#    put one in the file.
#
# 3. Bind a convenient key combination to this script.
#
#    TIP: If you're using XMonad, add something like this to xmonad.hs
#      ((mod4Mask, xK_s), spawn "/path/to/snippy")
#
DIR=${HOME}/.snippy
DMENU_ARGS="-b -nf green -nb black -sf yellow -sb black"
XSEL_ARGS="--clipboard --input"

cd ${DIR}

# Use the filenames in the snippy directory as menu entries.
# Get the menu selection from the user.
FILE=`find .  -type f | grep -v '^\.$' | sed 's!\.\/!!' | /usr/bin/dmenu ${DMENU_ARGS}`

if [ -f ${DIR}/${FILE} ]; then
  # Put the contents of the selected file into the paste buffer.
  xsel ${XSEL_ARGS} < ${DIR}/${FILE}
  # Paste into the current application.
  xdotool key ctrl+v
fi

snippy1line
#!/bin/bash
#
# Based on "snippy" by "sessy" 
# (https://bbs.archlinux.org/viewtopic.php?id=71938)
#
# This version may be more convenient for people who only need 
# one-line snippets, because all your snippets can go in one file.
#
# You will also need "dmenu", "xsel" and "xdotool". Get them from your linux
# distro in the usual way.
#
# To use:
# 1. Create a file in your home directory called ".snippyrc".
#
# 2. The format of the file is shown below:
#
#        [tag] text_to_paste
#
#    Where "[tag]" starts in column 1. For example:
#
#        [hw] Hello, world!
#        [wombatSmilie] [img]http://nualeargais.ie/pictiuir/emoticons/wombatSmilie.gif[/img]
#
# 3. Bind a convenient key combination to this script.
#
#    TIP: If you're using XMonad, add something like this to xmonad.hs
#      ((mod4Mask, xK_s), spawn "/path/to/snippy")
#
CONFIG=${HOME}/.snippyrc
DMENU_ARGS="-b"
XSEL_ARGS="--clipboard"

# Display the menu and get the selection
SELECTION=`sed 's/\].*/]/' ${CONFIG} | /usr/bin/dmenu ${DMENU_ARGS}`

# Strip out the square brackets...
PATTERN=`echo ${SELECTION} | tr -d "[]"`

# ...and put them back in, escaped with a backslash.
# Get the text associated with the selection.
TEXT=`grep "\[${PATTERN}\]" ~/.snippets | sed "s/\[${PATTERN}\] //"`

if [ "${TEXT}" ]; then
  # Put the selected string (without the trailing newline) into the paste buffer.
  echo -n ${TEXT} | xsel ${XSEL_ARGS}
  # Paste into the current application.
  xdotool key ctrl+v
fi

Haskell daemon, cuid a dó

D'athfhachtóirigh (refactored) mé an cód:

Daemon.hs

module Daemon where

import System.Exit
import System.IO.Unsafe
import System.Posix.Signals
import Control.Concurrent

class DaemonState a where
  initialise :: IO a
  work :: a -> IO a
  finalise :: a -> IO ()

termReceived = unsafePerformIO (newMVar False)

handleTERM :: IO ()
handleTERM = swapMVar termReceived True >> return ()

loop :: (DaemonState a) => a -> IO (Maybe a)
loop d = do
  timeToStop <- readMVar termReceived
  if timeToStop
    then finalise d >> return Nothing
    else work d >>= loop

start :: (DaemonState a) => IO (Maybe a)
start = installHandler sigTERM (Catch handleTERM) Nothing >>  initialise >>= loop



Seo úsáid samplach:
Main.hs
module Main where

import Daemon

instance DaemonState Int where

initialise = do
  putStrLn "Starting up"
  return 0

work i = do
  putStrLn (show i)
  return (i+1)

finalise i = do
  putStrLn "Shutting down"
  return ()

main = start :: IO (Maybe Int)

12 November 2010

Haskell daemon

Seo sampla daemon Haskell:


import System.Exit
import System.IO.Unsafe
import System.Posix.Signals
import Control.Concurrent

termReceived = unsafePerformIO (newMVar False)

handleTERM :: IO ()
handleTERM = do
swapMVar termReceived True
return ()

wrapup :: IO ()
wrapup = do
-- Shut down cleanly
putStrLn "shutting down"
return ()

doWork :: IO ()
doWork = do
-- For now, just pretend we're doing something
putStrLn "working"
threadDelay 20000

loop :: IO ()
loop = do
timeToStop <- readMVar termReceived
if timeToStop
then wrapup
else do
doWork
loop


main = do
installHandler sigTERM (Catch handleTERM) Nothing
loop

Údaraigh cabal pacáistí a shuiteáil go huilíoch mar réamhshocrú

(Turn on --global by default in cabal)

Cuir ~/.cabal/config in eagar

user-install: False
root-cmd: sudo

Cuir úsáideoir le liosta "sudoers"

Mar root, clóscríobh visudo

Scrollaigh go:

root ALL=(ALL) ALL
user ALL=(ALL) ALL
<-- Clóscríobh an líne seo

aptitude install git doesn't!

Nach sílfeá gurb é an rud a dhéanfadh an t-ordú aptitude install gitgit a shuiteáil? Bhuel, ní bheadh an ceart agat. Ina áit sin, cuir an líne seo le /etc/apt/sources.list:

deb http://backports.debian.org/debian-backports lenny-backports main contrib non-free

Agus ansin, clóscríobh an t-ordú seo:

aptitude -t lenny-backports install git



Running aptitude install git on Lenny doesn't actually install git! Instead, put the following in /etc/apt/sources.list:

deb http://backports.debian.org/debian-backports lenny-backports main contrib non-free

And then do:

aptitude -t lenny-backports install git

31 October 2010

Debian

Tar éis seacht mbliana le Gentoo, tá sé in am distro nua a thriall. Gach cúpla mí, bhriseadh an shuiteáil le uasghrádú éigin, agus tá mé tinn tuirseach dé. Is maith liom an smacht atá agam le Gentoo, ach silim nach bhfuil an QA ro-mhaith le déanaí.

Tá mé ag baint triall as Debian anois. Ba choir domh cúpla cleas Haskell Platform na linne a shuiteáil, agus XMonad na linne freisin, ach tá sé ceart go leor anois. Tá cúpla breiseáin nach bhfuil ar fáil le IceWeasel (an Firefox fork atá ar fáil le Debian de thairbe licensing issues).

An mbeidh Debian níos fearr domh? Is maith an scéalaí an aimsir.

17 August 2010

Mwah ha ha ha!

Tá mé ag dearadh scéim cóid DNA agus rialacha ceannais (dlíthe Mhendel) do mo chuid créatúir saorga. An-chraic ar fad!

I'm designing a DNA encoding scheme and Mendellian dominance rules for my alife critters, and having a blast.

14 August 2010

ceist matamaitice

An dtugtar ainm éigin (i mBéarla) faoi uimhríocht (snámhphointe) sa raon ó náid go haon? Ba cheart dó. Bím go minic ag plé le huimhreacha mar sin.

Is maith liom an frása "uimhríocht snámhphointe". Tá na pointí ag snámh in aigéan

Is there a special name for (floating-point) numbers in the range 0..1?

11 June 2010

Peann nua, agus う

Fuair mé peann nua inniu. In ndáiríre, is sean-pheann é, Mabie Todd Blackbird óna tríochaidí. Tá beagán fleisc ar an gob, ina cosúil le cleiteán bídeach. Is foirfe é don scríobh Hiragana. Inniu, tá mé ag cleachtadh an tríú litir: う.

Níl plean agam Seapáinis a foghlaim; níl suim agam ach sa chóras scríofa faoi láthair. Ansin, cén fáth go bhfuil mé ag foghlaim an aibítir gan an teanga? Tá suim agam sa chórais scríofa go ginearálta. Agus ní maith liom nach bhfuil mé ábalta na focail is logainmneacha Seapáinise a aithint a bhfuil eolas agam orthu: kawaii, kimono, Kyoto, agus mar sin de.

An darna litir Hiragana

D'fhoghlaim mé an darna litir Hiragana: い. Bhú hú! Tá dhá litir agam anois. Agus thart fá céad eile le fhoghlaim. Agus ansin, Katakana agus Kanji.

Tá mé ag léamh a lán manga faoi láthair (ach i mBéarla -- ní thuigim Seapáinis). Scríobhtar iad ó dheis go clé (agus ó bhun go barr). Nuair a théim ar ais go greannán Béarla, is minic go léim iad ar an treo mí-cheart, agus ní bhím ábalta an greann a thuigbheáil!

10 June 2010

Páipéir agus Pinn

Tá mé ar saoire an tseachtain seo. Níl mé ach chillin' sa bhaile, ach is iontach mo scíth a ligeann.

Scríobh mé an chéad dréacht do mo chéad pháipéar an tseachtain seo chaite, agus bhí mo chomhairleoirí an-sásta leis. Is dócha go mbeidh mé ábalta é chríochnú an tseachtain seo chugainn. Ansin, caithfidh muid iris mheasúnaithe atá sásta é a chur i gcló. Tá sé ag plé le ríomhaire cláraitheoir do líonra néarach, agus tá mé ag úsáid Haskell mar shampla.

Tá caitheadh aimsire nua agam: pinn tobair. Inniu fuair mé Sailor Sapporo, dubh le cóiriú "Rhodium", le gob 14K "F". Scríobhann sé go séimh agus go mín. Iontach deas. Tá Sailor Industrial Revolution agam freisin. Tá sé beagnach chomh deas leis an Sapporo, ach tá gob cruach aige.

Thosaigh mé aibítir Hiragana a fhoghlaim inné. Seo an chéad litir: あ. Scríobh mé an litir thart fá caoga am, agus dá bhrí sin, tá an-aithne agam air.

08 January 2010

Cúpla catagoa



Origin of photo unknown. Lolcatified by mhwombat.






"Mo dhreolín" photo posted on Flikr by ColKorn1982, and subsequently lolcatified by mhwombat. License: CC Attribution-Share Alike





"Cat & alpaca" photo by mhwombat. License: CC Attribution-Share Alike

07 January 2010

tástáil bogearraí agus mo chat

Tá Wombat beagán cantalach anois mar tá sí díreach i ndiaidh a cuid páipéar a grádú (rang tástála do ríomhchláir), agus ní dhearna a mic léinn go maith. Yeesh! Scríobhann mo chat cód níos fearr nuair a shiúlann sí trasna an mhéarchláir!

04 January 2010

gás cócaireachta, cuid a dó

De bhrí go mbíonn na siopaí dúnta Lá Caille, d'fhán mé go foighideach go dtí an céad lá eile gás cócaireachta a cheannach. Ach níor thosaigh an charr. Níor mhaith liom cuir trioblóid ar mo comharsana, agus dá bhrí sin d'fhán mé cúpla lá eile, go dí De Luain, nuair a bheadh an garáiste oscailte.

D'éirigh mé go luath maidin inniu, agus thosaigh mé an cithfholcadán. Ach bhí sé as feidhm freisin! Bhí mo chuid gruaige ró-shalach, agus dá bhrí sin, nigh mé mo chuid gruaige sa doirteal agus rinne mé "folctha spúinse". Ní raibh sé ró-dheas i mí Eanáir.

Chuir mé glaoch ar an gharáiste tar éis sin, ach ní raibh siad ábalta teacht mar tá an iomarca oighir ar na bóithre. Agus ar aon chaoi, dá dheiseoidís mo charr, níor mhaith liom tiománt díreach anois. B'fhéidir go leáfaidh an oighir i gceann cúpla huaire.

Ní raibh bia té agam le ceithre lá anuas!

01 January 2010

gás cócaireachta, cuid a haon

Chuaigh mé chun an siopa inné. Cheannaigh mé gach rud a bheith de dhíth orm ar feadh seachtaine, mar tá drochaimsir ann agus níor mhaith liom bheith ag tiomáint arís go luath. Chuir mé mo dinnéar sa oigheann, agus ansin... fuair mé amach go raibh an gás cócaireachta rite. Conas a déarfá arrrrrrgh!!! sa Ghaeilg?