Skip to content

Instantly share code, notes, and snippets.

View lolmaus's full-sized avatar
🧠
Reducing entropy

Andrey Mikhaylov (lolmaus) lolmaus

🧠
Reducing entropy
View GitHub Profile
@lolmaus
lolmaus / gist:5175bff6ea830d7e18d8ccf4c659a6e8
Last active May 26, 2024 12:32
ChatGPT 4o prompt evolution experiment
Hey ChatGPT, I would like to conduct an experiment combining two distinct fictional inspirations.
The first inspiration stems from Lem's 21st voyage of Ijon Tichy. In this story, the protagonist encounters a civilization that has mastered genetic manipulation to an extraordinary degree. They can transform their bodies and environments in ways that are both miraculous and disastrous. For example, some inhabitants have altered their sensory perceptions so intensely that they become incapacitated by the overwhelming influx of stimuli.
The second inspiration derives from Bostrom's concept of the Autonomous Architect. This AI was designed with the primary goal of creating the most aesthetically perfect structures. It pursued this goal to the extreme, converting entire landscapes into vast, intricate edifices, completely disregarding human needs and the natural environment in its unrelenting quest for architectural perfection.
Here's how the experiment will proceed: you will respond with a message that includes
@lolmaus
lolmaus / controllers.application\.js
Created November 21, 2022 13:13
Flattening an array with CPs
import Controller from '@ember/controller';
import { computed } from '@ember/object';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
owners = [
{
pets: [
{name: 'Foo'},
import Controller from '@ember/controller';
import EmberObject, {computed} from '@ember/object';
export default class ApplicationController extends Controller {
persons = [
EmberObject.create({name: 'foo'}),
EmberObject.create({name: 'bar'}),
];
@lolmaus
lolmaus / regard.js
Created October 20, 2022 11:04
Regard.ru HDD price/size parser
console.log(Array.from(document.querySelectorAll('.Card_row__3FoSA')).map(parent => {
const titleRaw = parent.querySelector('h6').textContent;
const price = parseInt(parent.querySelector('.Card_price__2Q9vg').textContent.replaceAll(/(?!\d)./g, ''), 10);
const [,sizeStr,unit,title] = titleRaw.match(/Жёсткий диск\s+(\d+)(\S+)\s+(?:\S+)\s+(.+)/);
const sizeUnknown = parseInt(sizeStr, 10);
const sizeGb = unit === 'Gb' ? sizeUnknown : sizeUnknown * 1000;
return {
title,
price,
sizeGb,
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class ApplicationController extends Controller {
@tracked value = 100000;
@action change(event) {
this.value = parseInt(event.target.value, 10);
}
@lolmaus
lolmaus / fah_restart.bat
Created February 11, 2022 08:46
C:\Users\lolmaus\AppData\Roaming\FAHClient\fah_restart.bat
@echo off
chcp 1251 >nul
set ln=Процесс fahcore найден!
set msg=FAHClient был перезапущен
chcp 866 >nul
:loop
cd %appdata%\FAHClient\
tasklist /fi "imagename eq fahcore_21.exe" | find /i "fahcore_21.exe" > nul
if not errorlevel 1 set res=true
tasklist /fi "imagename eq fahcore_22.exe" | find /i "fahcore_22.exe" > nul
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
class WithTrackedValue {
@tracked
value = false;
}
export default class ApplicationController extends Controller {
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { cached } from 'tracked-toolbox';
class Person {
@tracked firstName = 'Jen';
@tracked lastName = 'Weber';
@cached
@lolmaus
lolmaus / controllers.index\.js
Created November 16, 2021 09:57
Modifier on LinkTo
import Controller from '@ember/controller';
import { action } from '@ember/object';
export default class ApplicationController extends Controller {
@action alert() {
alert('Action happened');
}
}