Transform virtual screen in Wayland - wayland

The top of my laptop screen is broken and I am unable to view anything within a 1600x82 rectangle.
Is it possible in Wayland/XWayland to transform the virtual screen so that only the visible area of my monitor is used?
I managed to hack together a solution in X using xrandr:
#!/bin/sh
xrandr --newmode "1600x818_60.00" 107.33 1600 1688 1856 2112 818 819 822 847 -HSync +Vsync
xrandr --addmode eDP1 1600x818_60.00
xrandr --output eDP1 --fb 1600x818 --panning 1600x818 --mode 1600x818_60.00
# Yes this is hacky, but it's necessary to work around xrandr weirdness
sleep 1
xrandr --fb 1600x818 --output eDP1 --mode 1600x900 --transform 1,0,0,0,1,-82,0,0,1
However, I want to be able to do this in Wayland as well.

Related

Skylake hardware brightness changes too granular

I'm having a problem with Skylake i7-6700 HQ laptop display (HD 530 graphics) brightness changes:
If the value changes by 20 it works.
If the value changes by 19 it only works in multiple-hundred jumps.
If the value changes by <19 there is no brightness change at all.
However on my old Ivybridge laptop i7-3630 QM (HD 4000 graphics) brightness successfully changes in steps of 1.
Here is the script for testing:
#!/bin/bash
# Test all brightness levels from 1 to max_brightness
# For Intel i7-6700 HQ HD 530 graphics:
# - When change is 18 steps brighhness doesn't change at all.
# - When change is 19 steps brightnesss changes on multi-hundred point jumps.
# - When change is 20 steps each change applied as expected.
# For Intel i7-3630QM steps of 1 work fine!
if [[ $(id -u) != 0 ]]; then
echo >&2 "$0 must be called with sudo powers"
exit 1
fi
cd /sys/class/backlight/*/
max=$(cat max_brightness)
save=$(cat brightness)
for (( i=1; i < max; i=i+20)); do
echo $i > brightness
echo setting brightness level: $i
sleep .005
done
echo $save > brightness
echo resetting brightness level from $max back to: $save
exit 0
I think my skylake is working fine other than weird temperatures reported for pch_skylake sensor:
$ paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/...$/.0°C/'
INT3400 Thermal 20.0°C
SEN1 56.0°C
SEN2 52.0°C
SEN3 57.0°C
SEN4 61.0°C
pch_skylake -44.0°C
B0D4 50.0°C
x86_pkg_temp 52.0°C
Other than that Linux intel micro-code is definitely activated on old laptop (Ubuntu 16.04) but may not be loaded on new laptop (Ubuntu 16.04.5).
Edit: Rebooted with Ubuntu 18.04.1 LTS, Kernel 4.15.0-36 and the same behaviour is witnessed.
Confirmation: I wonder if others have a Skylake laptop and can confirm hardware brightness works the same way.
Question: For the app I'm developing, do I have to put in a feature for each user to test smallest granular brightness change supported?
Backlight brightness is separate from the GPU proper; the iGPU that's part of the CPU chip just produces pixel data for the LCD, e.g. as a DisplayPort output. (Or in laptops, often an eDP lower-voltage signal).
Note that in a desktop, you can't adjust the backlight brightness with software; there's no connection from the normal GPU hardware / drivers with the backlight.
The software backlight control in laptops is pretty much separate from the iGPU, and has nothing to do with whether it's a Skylake or IvyBridge. The backlight control is a separate hardware device with separate I/O ports (or memory-mapped IO registers or whatever).
Finer granularity backlight adjustment is a property of the laptop design, not the CPU. Specifically of the backlight technology and controller hardware.
(This is my understanding, but I haven't actually looked at GPU or backlight / ACPI driver code in enough detail to be 100% sure this is accurate.)
I have no idea if it's possible for software to query the true / meaningful granularity; this answer is only to point out the misconception that it's dependent on the GPU or GPU drivers.

Reversing a hash to find something which works, but hashcat seems to have issues

I saw some unfamiliar code on a project i was working on.
I saw a function which said:
var salt = 1514691869198;
var result hex_hmac_sha1(salt, hmac_sha1(password))
# result is: 462435F34EAD6BB7C70751D90984DADD90EED9A4
I was having some issues with hashcat though. It seems to be getting killed early because of a driver or something.
It seems that option -m160 would be the one I would want to use since 160 = HMAC-SHA1 (key = $salt) in the man page for it.
Given the sha1.js file i was looking at, which gave me the code above, it showed the salt as the key which makes me think the 160 code as the most relevant.
Obviously this is a nested sha, but trying to find something to reverse it would be ideal.
I am aware reversing a hash would not return the actual password, but I figured I could run a wordlist and attempt to find a hash which matches this one.
That being said, I was thinking I can find a string which works. I am having issues though building either the hashcat command or finding this answer in general. I was not sure how i would want to put the hash in the command. I was thinking it would be along the lines of:
hashcat -m160 462435F34EAD6BB7C70751D90984DADD90EED9A4: 1514691869198 mywordlist.txt
but it seems to fail for me with the following:
* Device #1: Not a native Intel OpenCL runtime. Expect massive speed loss.
You can use --force to override, but do not report related errors.
No devices found/left.
Started: Sat Dec 30 22:52:33 2017
Stopped: Sat Dec 30 22:52:33 2017
and if i used --force it would say:
hashcat (pull/1273/head) starting...
OpenCL Platform #1: The pocl project
====================================
* Device #1: pthread-Intel(R) Core(TM) i7-4770HQ CPU # 2.20GHz,
2656/2656 MB allocatable, 1MCU
Hashes: 1 digests; 1 unique digests, 1 unique salts
Bitmaps: 16 bits, 65536 entries, 0x0000ffff mask, 262144 bytes, 5/13
rotates
Rules: 1
Applicable optimizers:
* Zero-Byte
* Not-Iterated
* Single-Hash
* Single-Salt
Watchdog: Hardware monitoring interface not found on your system.
Watchdog: Temperature abort trigger disabled.
Watchdog: Temperature retain trigger disabled.
* Device #1: build_opts '-I /usr/share/hashcat/OpenCL -D VENDOR_ID=64 -D CUDA_ARCH=0 -D VECT_SIZE=1 -D DEVICE_TYPE=2 -D DGST_R0=3 -D DGST_R1=4 -D DGST_R2=2 -D DGST_R3=1 -D DGST_ELEM=5 -D KERN_TYPE=160 -D _unroll -cl-std=CL1.2'
* Device #1: Kernel m00160_a0.0bbec6e5.kernel not found in cache! Building may take a while...
Kernel library file /usr/share/pocl/kernel-i686-pc-linux-gnu.bc doesn't exist.
Try reading How to use hashcat on CPU only
Relevant parts:
Download latest OpenCL Drivers and Runtimes for CPU:
https://software.intel.com/en-us/articles/opencl-drivers#latest_CPU_runtime
Latest release (16.1.1) – at time of writing

Listing the volumes on Solaris OS

I am new to solaris OS, and trying to write a script which collects volume data from solaris box.
We did a similar script for Linux, and we used "df -P" command to list the volumes, and select the entries that start with "/dev".
By default, in linux, i could see a volume "/dev/sda1".
when i run df command on solaris box(df -k),i could not see any entry similar to (/dev/*) in my output.
When i mounted a CD, i could see an entry in df output as below.
/dev/dsk/c1t1d0s2 57632 57632 0 100% /media/VBOXADDITIONS_5.0.14_105127
So, in solaris, what is the pattern, i should look for to pick the volumes?
And, why am I not seeing at least one volume in the pattern /dev/
is it "/dev" or something else?
I am using solaris 11 image on oracle virtual box.
When i try "format" command, i could see 3 disks:
AVAILABLE DISK SELECTIONS:
0. c1d0 <VBOX HAR-8ea18e8b-2b2a0a5-0001-31.25GB> testvolu
/pci#0,0/pci-ide#1,1/ide#0/cmdk#0,0
1. c2d0 <VBOX HAR-b4343b55-dbed77c-0001 cyl 1020 alt 2 hd 64 sec 32>
/pci#0,0/pci-ide#1,1/ide#1/cmdk#0,0
2. c3t0d0 <ATA-VBOX HARDDISK-1.0 cyl 1009 alt 2 hd 64 sec 32>
/pci#0,0/pci8086,2829#d/disk#0,0
But, i dont see any partition in "df -k"
Also, i read here(https://docs.oracle.com/cd/E19455-01/805-6331/6j5vgg680/index.html), that disk names should be in "/dev/dsk/*" format.
Solaris 11 uses ZFS which has no one to one relationship between volumes (partitions) and file systems.
You can look at zpool status output to get the underlying devices.
$ zpool status
pool: rpool
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c1t0d0 ONLINE 0 0 0
Here, the whole c1t0d0 disk is used, hence no sx or px suffix.

print kstat when updated (multiple times in 1 second)

I am trying to gather statistics via kstat which I currently use dtrace to gather.
It is not count based information but new data every single time.
The minimum interval on kstat print is 1 second.However ,the data that I need changes several times within a second.Is there a way(API) to get data from kstat whenever the kstat is updated that doesn't use dtrace ?
Outside with dtrace, there is no way to get the statistics when they are updated however, the C libkstat API allows retrieving kstat statistics with an arbitrary sub second sampling rate.
There is also a perl api should you want to do it with scripting.
A very simple way to use it would be to create a customized kstat command (which happen to already be a perl script leveraging the kstat perl api) and modify it to use high resolution timers instead of the default one, e.g.:
$ sed '
s/sleep($interval);/Time::HiRes::usleep($interval*1000.);/
/use Sun::Solaris::Kstat/a\
use Time::HiRes;
' /usr/bin/kstat > /var/tmp/kstat_ms
$ chmod +x /var/tmp/kstat_ms
$ /var/tmp/kstat_ms -n lo0 500 3
module: lo instance: 0
name: lo0 class: net
crtime 19.559031813
ipackets 532
opackets 532
snaptime 4309.506435597
module: lo instance: 0
name: lo0 class: net
crtime 19.559031813
ipackets 534
opackets 534
snaptime 4310.008578348
module: lo instance: 0
name: lo0 class: net
crtime 19.559031813
ipackets 536
opackets 536
snaptime 4310.511617682

Google deepmind q learning setup

Hi I'm trying to run the deepmind q learning software on my mac. I believe I have all the necessary libraries to run the network. I don't understand however to actually run the "run_cpu" or "run_gpu" command. Ive tried running it in terminal with the file followed by the game name breakout. I.e. "./run_gpu breakout". The github page with the code says that all you need to do is copy the rom from the roms folder but I'm not quite sure what that means/how to do it. The repository can be found here: https://github.com/kuz/DeepMind-Atari-Deep-Q-Learner
I'm sure I'm missing something really really simple here. Here's the terminal print out:
Els-MacBook-Air:DeepMind-Atari-Deep-Q-Learner-master elcapitan$ ./run_gpu breakout
-framework alewrap -game_path /Users/elcapitan/Desktop/DeepMind-Atari-
Deep-Q-Learner-master/roms/ -name DQN3_0_1_breakout_FULL_Y -env breakout -
env_params useRGB=true -agent NeuralQLearner -agent_params
lr=0.00025,ep=1,ep_end=0.1,ep_endt=replay_memory,discount=0.99,hist_len=4,learn_start=50000,replay_memory=1000000,update_freq=4,n_replay=1,network="co
nvnet_atari3",preproc="net_downsample_2x_full_y",state_dim=7056,minibatch_s
ize=32,rescale_r=1,ncols=1,bufferSize=512,valid_size=500,target_q=10000,cli
p_delta=1,min_reward=-1,max_reward=1 -steps 50000000 -eval_freq 250000 -
eval_steps 125000 -prog_freq 10000 -save_freq 125000 -actrep 4 -gpu 0 -
random_starts 30 -pool_frms type="max",size=2 -seed 1 -threads 4
./run_gpu: line 46: qlua: command not found
Sorry if this sounds uber dumb. Anyway I'd appreciate a solution if you have one. Thanks!
You need to install qlua, try
sudo luarocks install qtlua