think tank forum

general discussion » solutions

dannyp's avatar
13 years ago
link
dannyp
dʎuuɐp
you know you want to document them, because you spent time researching them. put them here and give some context.
dannyp's avatar
13 years ago
r1, link
dannyp
dʎuuɐp
I'll kick things off:

On atlas, a FreeBSD shell server I want my ssh sessions to show me my local timezone. I wanted something like this but for BSD.

resources:
irc://chat.taucher.net #bsd
andre
http://www.cyberciti.biz/faq/howto-set-date-a … n-freebsd/
/usr/share/zoneinfo/ -- for finding proper time zone names

but instead of "TZ=" or "export" the solution is:

$setenv TZ 'America/Los_Angeles'

thanks andre :)
dannyp's avatar
13 years ago
link
dannyp
dʎuuɐp
In tmux I set up my status line today:


set-option -g status-right '#[fg=magenta]»» #[fg=cyan]#(./dpupt) #[fg=magenta]»» #[fg=cyan,bold] %m-%d %H:%M'



That's the final version as of today.

what's the contents of dpupt?


uptime | awk '{print $7" " $8" " $9": " $11" " $12" " $13}'



I had to do this because of the single quotes not being handled nicely in tmux.conf.

There are simpler ways to do the loads but i don't think they look as good. Also: atlas is very underutilized :)
dannyp's avatar
13 years ago
link
dannyp
dʎuuɐp
my atlas tmux desktop:


#!/bin/sh
tmux start-server
tmux new-session -d -s desktop -n chat
tmux new-window -t desktop:1 -n text
tmux select-window -t desktop:0
tmux send-keys -t desktop:0 'clear; echo hello pmania' C-m
tmux split-window -t desktop:0
tmux resize-pane -U 10
tmux send-keys -t desktop:0 'irssi -c chat.taucher.net' C-m
tmux split-window -h
tmux send-keys -t desktop:0 'irssi -c irc.freenode.net' C-m
tmux select-window -t desktop:1
tmux send-keys -t desktop:1 'vim' C-m
tmux split-window -ht desktop:1
tmux select-window -t desktop:0
tmux attach-session -d -t desktop

lucas's avatar
13 years ago
link
lucas
i ❤ demo
good infos for me! thanks
dannyp's avatar
13 years ago
link
dannyp
dʎuuɐp
the uptime part (dpupt) is actually buggy -- workin' on it tomorrow
dannyp's avatar
13 years ago
link
dannyp
dʎuuɐp
I needed a fast way to convert loosely given time zones of various formats. It had to accept 'to' and 'from' conversions quickly without knowing too many specifics. The answer? usually timeanddate.com but Wolfram|Alpha is faster.

You usually need to look up (or know) the major city's time zone, and find and select that time zone from a big list, or use the UTC/GMT offset.

http://www.wolframalpha.com/input/?i=6%3A00+am+tokyo+to+pst
http://www.wolframalpha.com/input/?i=10%3A00+ … o+istanbul

This may not be useful to people who only have a few conversions to do, but I do a lot.

Further did you know the set of time zones "Etc/GMT" is a Posix standard that works opposite of what you would intuitively consider GMT offsets? Be careful using these things, it's tempting seeing the list of offsets to use them as surely they would be intuitive. Not the case.

Etc/GMT+1:00 is like GMT-1:00

> # We use POSIX-style signs in the Zone names and the output abbreviations,
> # even though this is the opposite of what many people expect.
> # POSIX has positive signs west of Greenwich, but many people expect
> # positive signs east of Greenwich.  For example, TZ='Etc/GMT+4' uses
> # the abbreviation "GMT+4" and corresponds to 4 hours behind UTC
> # (i.e. west of Greenwich) even though many people would expect it to
> # mean 4 hours ahead of UTC (i.e. east of Greenwich).
lucas's avatar
13 years ago
link
lucas
i ❤ demo
> but instead of "TZ=" or "export" the solution is

note that this is shell dependent
lucas's avatar
13 years ago
link
lucas
i ❤ demo
> Further did you know the set of time zones "Etc/GMT" is a Posix standard that works opposite of what you would intuitively consider GMT offsets?

weird, interesting, and good to know.
Carpetsmoker's avatar
13 years ago
link
Carpetsmoker
Martin
On FreeBSD you can (should?) use tzsetup(8).
dannyp's avatar
13 years ago
link
dannyp
dʎuuɐp
I'll look into it, thanks CS :) I was having issues with tmux reporting the current time, maybe because the server doesn't refresh and use the environment variable when it has been on constantly.

I fixed the dpupt thing, i pretty much did a 'uptime | cut' type command and got rid of the external file. it had a little too many characters than I want, but it's more consistent than my awk indexes that change depending on the time, amount of days and such.

Someone in #tmux helped me find another way, but I didn't pursue it completely because I had enough of that problem for a while.

Glad some of this is useful already.
Carpetsmoker's avatar
13 years ago
link
Carpetsmoker
Martin
If you use tcsh you can use something like:
set rprompt = "%m:%T"

I find that very useful anyway ...
Carpetsmoker's avatar
13 years ago
r1, link
Carpetsmoker
Martin
The way, here's a little trick to download flash movies from any site (At least any site I've so far visited).

Flash saves the files in /tmp/Flashxxxxx, juts wait for Flash to fully buffer/download the video, and copy this file.
Crude, but works.

Doesn't work on Windows, Windows enforces a file lock, and you can't even read it.

The only downside is that you need to install flash ...
dannyp's avatar
13 years ago
link
dannyp
dʎuuɐp
you're in windows 7, you want to use a batch file in a specific windows folder quickly.

shift+right click: open command window here.
as opposed to:
select path bar, copy, windowsflag+r, cmd, "cd ", right click, enter.

note: this batch file creates some command line output.