Author Archives: ace

New laptop – ASUS ROG Zephyrus G14

After 8 years with MacBook Air I had to upgrade it. The main reason was the urge to back to Windows ecosystem. I still think that no serious work can be done on MacOS.

Anyway, after some research I wanted to get something with 14″ screen and with Ryzen 9 from 6000 series (great performance when needed + superior energy saving features). I had to place the order in July/August 2022, and my options were… none! I wanted a Lenovo ThinkPad, but they’re just not available. I saw Asus laptops showing up briefly in some shops and I was able to snipe something that had almost everything I wanted.

Some raw specs:

  • Model: GA402RK – L8152W
  • CPU: AMD Ryzen 9 6900HS (8 cores, 16 threads, 3.30–4.90 GHz, 20 MB cache)
  • GPU: AMD Radeon 680M with 8GB GDDR6
  • RAM: 32GB (DDR5, 4800MHz)
  • Storage: 1TB NVMe (upgradeable)
  • Screen: 14″ mat LED IPS, 2560 x 1600, 120Hz
  • Weight: 1720g
  • Two power supply units provided (lighter USB-C for travel + heavier dedicated one for performance)

It arrived in a nice, premium packaging. I had to charge it before first run. The build quality is good, but not nearly what Apple provides. It has 4 speakers, but the sound quality is super bad, compared to a 8 year old MacBook Air.

It comes with Windows 11 Home, so I’ll have to upgrade it to Pro at some point. It took quite a bit of time to set up the very basics, which was annoying. I still can’t get it to properly enter power saving mode when I close it, so it uses 1% battery per hour if I don’t power it off. The on-case bling bling display is just annoying. I’m uses to high-end Razer mechanical keyboards, so I was underwhelmed with the feel of the one I got with the laptop. That pretty much sums up the downsides.

On the good side – the screen is great, camera is decent, and performance is really, really good. With my average use the battery lasts 5 hours. I can get over the small issues I pointed out above, so in the end I’m pretty happy with this laptop.

Raspbian Stretch, WiFi and TP-Link TL-WN725N

Few weeks ago I had to install fresh Raspbian on my old Raspberry Pi 2B. Everything was way smoother than few years ago, when I bought it. The only annoying issue I had was getting the WiFi to work properly. My TP-Link card (TL-WN725N) had it’s diode indicating that it’s operational, but Raspbian couldn’t find any networks.  I saw the OS recognizing the card, and after scanning for SSIDs, I saw my network. It was pretty weird – Raspbian still wouldn’t connect to them. After few hours of googling and trying few solutions, I found two sources with tips that helped me.  Here they are:

Reference #1

Reference #2

Plastic SCM and binlog issues

Plastic server in our company is backed up in several ways. One of them is MySQL replication, simple master -> slave setup. One day the error above (logging format issues) popped up. Thankfully, the fix was pretty simple, but it took some time to find it.

Firstly, you need to stop the MySQL slave. Execute “STOP SLAVE;” command in MySQL console to do it.

Secondly, run the commands below on the master’s MySQL console:

FLUSH TABLES WITH READ LOCK;
FLUSH LOGS;
SET GLOBAL binlog_format = 'MIXED';
FLUSH LOGS;
UNLOCK TABLES;

Remember to set the binlog format in the master’s config file!

The last step is to start the slave replication. That’s it!

Jenkins, SSL, and cPanel

Straight to the point. The basic idea is to hide Jenkins behind an Apache reverse proxy. I’m using cPanel on CentOS – and cPanel doesn’t like fiddling with httpd.conf. You’ll find lines like this in it:

# To customize this VirtualHost use an include file at the following location
# Include "/usr/local/apache/conf/userdata/std/2_4/user/domain.com/*.conf"

I created two config files – I want to set up proxy and redirect non-HTTPS requests to HTTPS:

"/usr/local/apache/conf/userdata/ssl/2_4/user/domain.com/ssl.conf":
ProxyRequests     Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode

<Proxy *>
 Order deny,allow
 Allow from all
</Proxy>

ProxyPass         /  http://localhost:8080/ nocanon
ProxyPassReverse  /  http://localhost:8080/

RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
"/usr/local/apache/conf/userdata/std/2_4/user/domain.com/redirect.conf"
RewriteCond %{REQUEST_URI} !^/.well-known
RewriteRule (.*) https://jenkins.domain.com/$1 [R=301,L]

After that, run commands to refresh the configs and restart Apache:

$ /usr/local/cpanel/bin/apache_conf_distiller --update
$ /usr/local/cpanel/bin/build_apache_conf
$ service httpd restart

And we’re done!

UPDATE – iptables rule to block port 8080 traffic outside of localhost:

iptables -A INPUT -p tcp --dport 8080 -s localhost -j ACCEPT
iptables -A INPUT -p tcp --dport 8080 -j DROP

Hardware update: GTX 1070

Few days ago I got an GFX upgrade: I bought a GeForce GTX 1070 by MSI, thanks to @Obraxis. I’m really happy with it – price was good, I got a free copy of latest Gears of War, performance is awesome, and it does have passive mode. I had few issues with it though!

My previous GPU was a GTX 780 by Asus. It was pretty awesome too, but damn, performance got DOUBLED with the 1070! Check out the benchmark results here. Score on GTX 780 was almost exactly 3000 points.

firefox_2016-10-11_23-34-50

The big issue I had with this piece of hardware was pretty intense. Right since I logged on to my OS, I saw shit ton of artifacts. I was confused – I checked all cables and installed fresh drivers. It was a bit better, but I had to return the card on day 3. The second unit is having this issue too, but I haven’t seen it since a week ago.

After some digging, it turned out I was not going insane. MSI had to recall a whole batch of those cards released on Chineese market! But hey, I’m in Europe, right? Nope, looks like a lot of manufacturers used shitty Micron memory! Thankfully, it can be fixed with an update to card’s BIOS. Again, thanks to @Obraxis for sending me that link. After checking my card with GPU-Z, here’s what I saw:

2016-10-22_03-01-24

All in all, I’m happy with my new GPU!

 

Vue.js

I’m tired of Angular. I never had time to learn it properly. Other JS frameworks are even less appealing for me. But something has changed – Vue.js appeared on the horizon. It looked very promising, and I decided to learn it. Why? It’s lightweight, clean, and has all the features I need.

Vue.js 2.0 is going to be released pretty soon, it’s going to be much faster than 1.0, while keeping the API largely the same.

There are the sources I used for learning:

You can see the mess I created in my lab at http://lab.acedude.pl/ in the “Vue.js framework” section.

3D in HTML5 using three.js

Let’s try some 3D things today. I just found a post about using three.js and decided to try it. Three.js website is full of excellent examples, the library is well documented, and there are plenty of tutorials lying around.

I just used the code from the blog post I found. Looks like using three.js is really simple. It should be easy to use it along with my favourite HTML5 game engine, ImpactJS. I was working on a tabletop game prototype, and three.js would fit perfectly to add some 3D awesomeness.

CSS – steps()

CSS animations are fun. I don’t have a lot of experience with them, so it’s the time to change it. First related thing on my “to learn” list is steps() function, for some reason.

steps() function is used for making non-fluid animations. It’s nothing big, so I’ll just drop a link here: How to Use steps() in CSS Animations If you have no experience with CSS animations, this is an excellent starting point.

The trick consists of two parts: you define the animation function:

.tick-tock {
    animation: tick-tock 60s steps(60, end) infinite;
}

the syntax is “animation: <keyframe definition name> <animation length> steps(<number of frames>, <direction>) <iteration count> <direction>;”

then you define the keyframes:

@keyframes tick-tock {
    to {
        transform: rotate(360deg);
    }
}

and that’s it. I tested it out in my lab: http://lab.acedude.pl/css-animations-steps/

It works. Best post ever.

Laravel, laravel-mongodb, Laravel Forge, and PHP 7

Oookay, so for some reason the mix from the title was a big deal. When you try to install laravel-mongodb package on servers created by Laravel Homestead or Forge – it’s going to fail. To be specific, when you try to run:

composer require jenssegers/mongodb

composer is going to start bitching about missing mongodb php extension. And you can’t install it until you run:

sudo apt-get install libcurl4-openssl-dev

Then you’ll be good to go. Install the new mongodb extension by running:

sudo pecl install mongodb

and then add the following line to your php.ini file (probably /etc/php/7.0/cli/php.ini & /etc/php/7.0/fpm/php.ini):

extension=mongodb.so

That should be it. Don’t forget to restart nginx.

CSS – flexbox

Flexbox, the new CSS layout type. Created to replace hacky and messy ways of doing things with CSS. I hate all that silly “post-css” stuff, so a widely-adopted, well-specified layout system sounded great to me.

To start, take a look at:

A little bit less interesting:

All in all, it’s an awesome piece of tech. Making responsive websites can be really fun with it. It should also eliminate all the hacks, and less code = better code. One concern is browser support. Sure, it is widely supported, but the issue right now is that the websites are rendered a little bit different on various devices and browsers. Hopefully it will get better with time.

Oh, and one last thing. Flexbox should simplify stuff. If you use it, because it’s cool, and then add table/grid/float/whatever -based layout to support older browsers – it’s just stupid.