Listing posts
Displaying posts 236 - 240 of 328 in total~~~ * ~~~
Filastrocche venete
Last update
2018-05-25
2018-05-25
«per non dimenticare :D»
Breve storia triste
1 2 3 4 | C'era una volta Piero se volta Casca 'na sopa Piero se copa |
La storia infinita (traumi infantili)
1 2 3 4 5 6 | Questa ze à storia de sior Intento che dura tanto tempo che mai la sé destrìga vuto che te à conta o che te à diga? |
~~~ * ~~~
Format a partition with EXT#
Last update
2018-03-18
2018-03-18
« — »
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # create the filesystem mkfs.extX -v \ # verbose -j \ # explicitly create the filesystem with an ext3 journal -b 4096 \ # block size (see /sys/block/sdXY/queue/physical_block_size) -E nodiscard \ # do not TRIM encrypted SSD (ext4 only) -L nice_label \ # set a volume label /dev/sdXY # tune options tune2fs \ -c 60 \ # check filesystem every 60 mounts -C 0 \ # set current mount count -i 2m \ # check filesystem every 2 months -e remount-ro \ # on error remount filesystem read-only -m 3 \ # reserve 3% of space to root/defrag -o journal_data \ # all data committed into journal before writing to disk /dev/sdXY |
Notes:
- remove line comments as they are not syntactically correct
- reserved space for defragmentation is useless for SSD: set 0% for data partitions and a number greater than 0 for system ones.
- if you use ext4 then read the post why Delayed Allocation is Bad and mount your partition with
-o nodelalloc
to make it safe against a server crash. - on the raspberry pi avoid mounting a partition with
journal_data
option because in some circumstances it may lead to untolerable abysmal performance
~~~ * ~~~
Ruby blocks, procs and lambdas
Last update
2018-03-08
2018-03-08
« — »
Proc and lambda
Both types are anonymous functions and a lambda
is just a special instance of Proc
, their differences are:
- Lambdas are defined with
->() {}
orlambda() {}
and procs withProc.new {}
orproc{}
- Procs return from the current method (as they become part of the caller method), while lambdas return from the lambda itself (like calling a different method).
- Procs do not care about the correct number of arguments, while lambdas will raise an exception.
1 2 3 4 5 6 7 8 | l = -> { puts 'this is a lambda' } l.class # Proc l.lambda? # true l.call # "this is a lambda" l = ->(n) { n * 2 } # lambda with arguments l.call 3 # 6 l.call 3, 4 # ArgumentError: wrong number of arguments |
Pay attention at the different return behaviour:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | l = -> { return 1 } p = Proc.new { return 1} puts l.call # 1 puts p.call # we cannot call return from the top-level context: # LocalJumpError: unexpected return def foo p = proc{ return 1} puts 'before' puts p.call # we can call return from a non top-level context puts 'after' end foo # before # 1 |
block
A block
is an instance of Proc passed as a parameter to a method.
1 2 3 4 5 6 7 8 9 10 11 | def implicit_block yield 1, 2, 3 if block_given? # execute block if passed end def explicit_block(&block) block.call 1, 2, 3 if block_given? # execute block if passed implicit_block &block # you can pass the block to another method end implicit_block{|p1, p2, p3| puts p1+p2+p3 } # prints 6 explicit_block{|p1, p2, p3| puts p1+p2+p3 } # prints 6 two times |
Source: blackbytes, sitepoint closures
~~~ * ~~~
XFCE4 Terminal preferences
Last update
2018-03-05
2018-03-05
«xfce4-terminal terminalrc»
My current ~/.config/xfce4/terminal/terminalrc
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | [Configuration] BackgroundDarkness=0.900000 BackgroundMode=TERMINAL_BACKGROUND_TRANSPARENT CommandLoginShell=TRUE FontName=Monospace 10 MiscAlwaysShowTabs=FALSE MiscBell=FALSE MiscBellUrgent=FALSE MiscBordersDefault=TRUE MiscConfirmClose=TRUE MiscCopyOnSelect=TRUE MiscCursorBlinks=FALSE MiscCursorShape=TERMINAL_CURSOR_SHAPE_BLOCK MiscCycleTabs=TRUE MiscDefaultGeometry=80x24 MiscDefaultWorkingDir= MiscHighlightUrls=TRUE MiscInheritGeometry=FALSE MiscMenubarDefault=FALSE MiscMiddleClickOpensUri=FALSE MiscMouseAutohide=FALSE MiscMouseWheelZoom=TRUE MiscRewrapOnResize=TRUE MiscSlimTabs=TRUE MiscTabCloseButtons=TRUE MiscTabCloseMiddleClick=TRUE MiscTabPosition=GTK_POS_TOP MiscToolbarDefault=FALSE MiscUseShiftArrowsToScroll=TRUE ScrollingLines=100000 ScrollingOnOutput=FALSE ShortcutsNoMenukey=TRUE ShortcutsNoMnemonics=TRUE TitleInitial=shell TitleMode=TERMINAL_TITLE_HIDE |
and all available preferences as of version 0.8.6:
Type | Property name |
---|---|
enum | BackgroundMode |
string | BackgroundImageFile |
enum | BackgroundImageStyle |
double | BackgroundDarkness |
double | BackgroundImageShading |
enum | BindingBackspace |
enum | BindingDelete |
enum | BindingAmbiguousWidth |
string | ColorForeground |
string | ColorBackground |
boolean | ColorBackgroundVary |
string | ColorCursorForeground |
string | ColorCursor |
boolean | ColorCursorUseDefault |
string | ColorSelection |
string | ColorSelectionBackground |
boolean | ColorSelectionUseDefault |
string | ColorBold |
boolean | ColorBoldUseDefault |
string | ColorPalette |
string | TabActivityColor |
uint | TabActivityTimeout |
boolean | CommandLoginShell |
boolean | RunCustomCommand |
string | CustomCommand |
uint | DropdownAnimationTime |
boolean | DropdownKeepOpenDefault |
boolean | DropdownKeepAbove |
boolean | DropdownToggleFocus |
boolean | DropdownStatusIcon |
uint | DropdownWidth |
uint | DropdownHeight |
uint | DropdownOpacity |
uint | DropdownPosition |
uint | DropdownPositionVertical |
boolean | DropdownMoveToActive |
boolean | DropdownAlwaysShowTabs |
boolean | DropdownShowBorders |
string | Encoding |
boolean | FontAllowBold |
string | FontName |
boolean | FontUseSystem |
boolean | MiscAlwaysShowTabs |
boolean | MiscBell |
boolean | MiscBellUrgent |
boolean | MiscBordersDefault |
boolean | MiscCursorBlinks |
enum | MiscCursorShape |
string | MiscDefaultGeometry |
boolean | MiscInheritGeometry |
boolean | MiscMenubarDefault |
boolean | MiscMouseAutohide |
boolean | MiscMouseWheelZoom |
boolean | MiscToolbarDefault |
boolean | MiscConfirmClose |
boolean | MiscCycleTabs |
boolean | MiscTabCloseButtons |
boolean | MiscTabCloseMiddleClick |
enum | MiscTabPosition |
boolean | MiscHighlightUrls |
boolean | MiscMiddleClickOpensUri |
boolean | MiscCopyOnSelect |
string | MiscDefaultWorkingDir |
boolean | MiscRewrapOnResize |
boolean | MiscUseShiftArrowsToScroll |
boolean | MiscSlimTabs |
boolean | MiscNewTabAdjacent |
enum | ScrollingBar |
uint | ScrollingLines |
boolean | ScrollingUnlimited |
boolean | ScrollingOnOutput |
boolean | ScrollingOnKeystroke |
boolean | ShortcutsNoHelpkey |
boolean | ShortcutsNoMenukey |
boolean | ShortcutsNoMnemonics |
string | TitleInitial |
enum | TitleMode |
string | WordChars |