1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace App\Console\Commands;
- use Illuminate\Console\Command;
- use App\Models\Comment;
- use App\Models\Article;
- class LoadSampleData extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'app:load-sample-data';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = 'Command description';
- /**
- * Execute the console command.
- */
- public function handle()
- {
- $article = new Article;
- $article->title = "Использование netcat-openbsd в качестве HTTP сервера";
- $article->description = "Если нет нормального веб-сервера...";
- $article->content = "<p>При необходимости передать файл по HTTP, но отсутствии какого-либо веб-сервера, можно использовать netcat:</p><pre><code>cat <(echo -en \"HTTP/1.0 200 OK\\r\\n\\r\\n\") arch/x86/boot/bzImage | nc -N -l -p 8080</code></pre>";
- $article->publish_at = now();
- $article->status = Article::STATUS_PUBLISHED;
- $article->save();
- $article->comments()->create([
- "name" => "somebody",
- "email" => "a@mail.ru",
- "content" => "Ну и дичь",
- ]);
- $article->comments()->create([
- "name" => "bodysome",
- "email" => "b@mail.ru",
- "content" => "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
- ]);
- $article = new Article;
- $article->title = "Построение спектрограмм при помощи ffmpeg";
- $article->description = "Спектрограммы с микрофона в реальном времени";
- $article->content = "<p>Под Linux, если есть pipewire (Или вообще везде так можно?), можно сделать так:<p><pre><code>ffplay -f lavfi -i 'amovie=mpv:f=pulse,aderivative,volume=10,showspectrum=color=viridis:s=1024x384' -an</code></pre><p>Просмотреть доступные устройства можно так:</p><pre><code>$ pw-link -o\nMidi-Bridge:Midi Through:(capture_0) Midi Through Port-0\nalsa_output.pci-0000_00_1f.3.analog-stereo:monitor_FL\nalsa_output.pci-0000_00_1f.3.analog-stereo:monitor_FR\nalsa_input.pci-0000_00_1f.3.analog-stereo:capture_FL\nalsa_input.pci-0000_00_1f.3.analog-stereo:capture_FR\nmpv:output_FL\nmpv:output_FR\n</code></pre>";
- $article->publish_at = now();
- $article->status = Article::STATUS_PUBLISHED;
- $article->save();
- $article = new Article;
- $article->title = "Test article";
- $article->description = "Short description";
- $article->content = "Test article contents";
- $article->publish_at = now();
- $article->save();
- }
- }
|