Skip to content

Instantly share code, notes, and snippets.

View SonnyRR's full-sized avatar

Vasil Kotsev SonnyRR

  • Fastmarkets
View GitHub Profile
@SonnyRR
SonnyRR / RARBG DB Magnet Search View.sql
Last active July 15, 2023 10:10
🔍Easily query the RARBG torrent sqlite database.
-- View to easily query the leaked RARBG torrent DB.
CREATE VIEW magnet_links as
SELECT id, title, cat, size, 'magnet:?xt=urn:btih:' || hash as magnetLink, imdb, dt
FROM items
ORDER BY dt DESC;
-- Example query:
SELECT * FROM magnet_links
WHERE title LIKE '%Apocalypse.Now.1979.Theatrical%'
LIMIT 501
@SonnyRR
SonnyRR / optimize-wsl-vdisk.ps1
Last active May 21, 2023 17:39
Optimize WSL2 virtual disk.
# Shutdown WSL2
wsl --shutdown
# If Hyper-V management tools + powershell module is enabled
optimize-vhd -Path "$($env:USERPROFILE)\AppData\Local\Docker\wsl\data\ext4.vhdx" -Mode full
# Otherwise use diskpart
diskpart
select vdisk file="$($env:USERPROFILE)\AppData\Local\Docker\wsl\data\ext4.vhdx"
attach vdisk readonly
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
function engine(movesArray) {
const board = [...Array(3)].map(x => Array(3).fill(false));
const magicSquare = [4, 9, 2, 3, 5, 7, 8, 1, 6];
const p1Symbol = "X";
const p2Symbol = "O";
let winner = null;
let turnCounter = 0;
let isP1Turn = true;
while ((winner = checkForWinner(board)) === null && areThereEmptySpacesOnBoard() === true) {
@SonnyRR
SonnyRR / GetCategoriesByProductsCount.cs
Created March 27, 2019 13:04
Exercise from DB-Advanced @ SoftUni March 2019
public static string GetCategoriesByProductsCount(ProductShopContext context)
{
var categories = context.Categories
.OrderByDescending(c => c.CategoryProducts.Count)
.Select(x => new
{
Category = x.Name,
ProductsCount = x.CategoryProducts.Count,
AveragePrice = $"{x.CategoryProducts.Average(c => c.Product.Price):F2}",
TotalRevenue = $"{x.CategoryProducts.Sum(c => c.Product.Price)}"