Skip to content

Instantly share code, notes, and snippets.

@lazanet
lazanet / init_sys_24.04.sh
Last active May 29, 2024 20:27
Script that sets up Ubuntu 24.04 to my liking
#!/usr/bin/env -S bash -e
set -o xtrace
set -e
WORK=${WORK-0}
function set_gnome_configuration {
# Configure power settings
dconf write /org/gnome/desktop/session/idle-delay "uint32 0"
(http[s]?\:\/\/www\d*\.zippyshare\.com\/v\/[\d\w]{0,10}\/file\.html)
@lazanet
lazanet / init_sys_22.04.sh
Last active May 14, 2024 09:02
Script that sets up Ubuntu 22.04 to my liking
#!/usr/bin/env -S bash -e
set -o xtrace
function set_gnome_configuration {
# Disable Gnome animations
gsettings set org.gnome.desktop.interface enable-animations false
# Dock settings
gsettings set org.gnome.shell.extensions.dash-to-dock show-apps-at-top true
@lazanet
lazanet / largeBackup.sh
Created April 11, 2020 22:16
Load large sql.gz
#!/bin/bash
pv backup.sql.gz | gunzip | mysql --max_allowed_packet=1GM -u root -p table_name
@lazanet
lazanet / PES20_player_bin.ksy
Last active April 8, 2020 12:12
Kaitai Struct parser for PES20 player.bin (WIP)
meta:
id: pes20_player_bin
file-extension: bin
endian: le
encoding: UTF-8
seq:
#- size: 8
- id: body
type: body
# size: _io.size - 8
@lazanet
lazanet / fetchFantasyOverlord.py
Last active February 7, 2020 15:19
Fetch latest predictions from `fantasyoverlord.com` to csv
#!/usr/bin/python3
import os, json, urllib, requests, csv
def html2csv(html):
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, features="html.parser")
table = soup.find("table")
headers = [th.text.strip() for th in table.select("tr th")]
with open("out.csv", "w") as f:
@lazanet
lazanet / db.php
Last active January 6, 2020 17:41
Simple PHP MySQL wrapper
<?php
/*
This is a simple automagic MySQL wrapper which provides basic protection from SQL injections.
Usage (after you change database parameters on line 19):
require_once("db.php"); //in whichever script you want to run SQL code
...
$result = execute_sql("SELECT userId, userName, userAvatar FROM users WHERE username = ? AND email = ?", [$username, $email]);
foreach($result as $row)
echo $row["userId"].";".$row["userAvatar"];
ffmpeg -i "concat:$(echo `ls .`|sed 's/ /|/g')" -c copy output.mts
rm 00*.MTS
ffmpeg -i output.mts file.mp4
@lazanet
lazanet / main.ts
Created September 10, 2019 20:39
Reupload instagram page backup
/* tslint:disable:no-console */
/*
Reuploads all photos on instagram page from page backup.
(when fascist mods decide that your satire must be hate speech)
sudo apt install node tsc npm
sudo npm install instagram-private-api
then copy your backup to ./backup
@lazanet
lazanet / slideshareDownload.js
Last active February 24, 2022 00:47
Download slides from slideshare
function getHighestResImg(element) {
if (element.getAttribute('srcset')) {
let highResImgUrl = '';
let maxRes = 0;
let imgWidth, urlWidthArr;
element.getAttribute('srcset').split(',').forEach((item) => {
urlWidthArr = item.trim().split(' ');
imgWidth = parseInt(urlWidthArr[1]);
if (imgWidth > maxRes) {
maxRes = imgWidth;