This is a quick guide to Kotlin programming language. The previous part of this guide is here
#Object Oriented
fun main(args : Array<String>) {
class local (val x : Int)
val y = local(10)
println("${y.x}")| #!/usr/bin/php5 | |
| <?php | |
| /* | |
| * Speedtest.net linux terminal client. | |
| * This is free and open source software by Alex based on a script from Janhouse | |
| * Script uses curl, executes ifconfig commands in shell and writes temporary files in temp_down folder. Make sure you have everything set up before using it. | |
| */ | |
| header("content-type: text/plain"); | |
| /* * * Configuration * * */ | |
| $iface="eth0"; |
| #ifndef __dbg_h__ | |
| #define __dbg_h__ | |
| #include <stdio.h> | |
| #include <errno.h> | |
| #include <string.h> | |
| #ifdef NDEBUG | |
| #define debug(M, ...) | |
| #else |
This is a quick guide to Kotlin programming language. The previous part of this guide is here
#Object Oriented
fun main(args : Array<String>) {
class local (val x : Int)
val y = local(10)
println("${y.x}")| Byobu Commands | |
| ============== | |
| byobu Screen manager | |
| Level 0 Commands (Quick Start) | |
| ------------------------------ | |
| <F2> Create a new window |
| #!/bin/bash | |
| # | |
| # Copy data from a Time Machine volume mounted on a Linux box. | |
| # | |
| # Usage: copy-from-time-machine.sh <source> <target> | |
| # | |
| # source: the source directory inside a time machine backup | |
| # target: the target directory in which to copy the reconstructed | |
| # directory trees. Created if it does not exists. | |
| # |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| #!/usr/bin/perl | |
| my $dev = "/sys/class/leds/led0/brightness"; | |
| my $OFF = "1"; | |
| my $ON = "0"; | |
| my ($ip) = `ifconfig`=~/ddr:(.*?) /; | |
| #print $ip; | |
| # Strip out the .'s | |
| $ip =~ s/\.//g; |
| # the following two lines give a two-line status, with the current window highlighted | |
| hardstatus alwayslastline | |
| hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]' | |
| # huge scrollback buffer | |
| defscrollback 5000 | |
| # no welcome message | |
| startup_message off |
| #! /usr/bin/env python | |
| import fileinput | |
| import argparse | |
| from operator import itemgetter | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--target-mb', action = 'store', dest = 'target_mb', default = 61000, type = int) | |
| parser.add_argument('vmtouch_output_file', action = 'store', nargs = '+') | |
| args = parser.parse_args() |
| def r = new Random() | |
| def num = r.nextInt(12000000).toString() | |
| println num | |
| println num.bytes.length | |
| println encodeNumber(num, getEncoder()) | |
| println encodeNumber(num, getEncoder()).bytes.length | |
| def getEncoder(){ | |
| ['1','2','3','4','5','6','7','8','9','0','-','=','!','@','#','$','%','^','&','*','(',')','_', | |
| '+','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z', |