Skip to content

Instantly share code, notes, and snippets.

View Eskuero's full-sized avatar

Óliver García Albertos Eskuero

View GitHub Profile
@Eskuero
Eskuero / index.html
Created August 10, 2021 18:10 — forked from CraftyGPT/index.html
CSS Transform Scale element to fit its parent
<html>
<head>
<title>CSS Transform Scale element to fit its parent</title>
<script src="scale2fit.js"></script>
<link rel="stylesheet" href="style.css"/>
<script>
(function(window) {
function main() {
const margin = 10;
requestAnimationFrame(function fitToParentOnResize() {
@Eskuero
Eskuero / synapse-tidying.py
Last active August 26, 2023 20:33
Tidying up a bit database and remote media from a synapse server using the admin API
#!/usr/bin/python
import requests
import time
import sys
import json
# Login and get a token
endpoint = "https://fromshado.ws"
# Admin credentials
ADMINUSER = ""
@Eskuero
Eskuero / tresenraya.py
Created May 8, 2020 18:26
Tres en raya
import math
def iswon():
global ganador
for i in range(0, 3):
# Victoria en horizontal
if (board[i][0] == board[i][1] == board[i][2]):
ganador = board[i][0]
return True
# Victoria en vertical
@Eskuero
Eskuero / minecraft
Created March 16, 2020 12:43
OpenRC minecraft startup config to run as unprivileged user
#!/sbin/openrc-run
description="Start minecraft server"
command_user="minecraft:minecraft"
command="/usr/bin/java"
command_args="-Xmx1024M -Xms1024M -jar server.jar nogui"
pidfile=mine.pid
command_background=true
directory="/home/minecraft"
@Eskuero
Eskuero / nino.toml
Created January 8, 2020 21:36
Sample nino config file
[keystores]
[keystores.store2]
path = "clave.jks"
[keystores.store2.aliases.key2]
name = "mykey"
[devices]
arm64 = ["192.168.0.3:5000"]
arm32 = ["68534e400605"]
[projects]
@Eskuero
Eskuero / alpine-mirror
Created August 26, 2019 23:34
Script to exclusively sync "x86_64" arch and "latest-stable" tag from an Alpine Linux mirror into a local folder.
#!/usr/bin/env sh
# make sure we never run 2 rsync at the same time
lockfile="/tmp/alpine-mirror.lock"
if [ -z "$flock" ] ; then
exec env flock=1 flock -n $lockfile "$0" "$@"
fi
src=rsync://rsync.alpinelinux.org/alpine/
dest=/var/lib/libvirt/filesystems/common/mirror
@Eskuero
Eskuero / dms.js
Created August 20, 2019 04:08
Clean all message in a certain Twitter conversation at DMS
while (message = document.querySelector('[data-testid="messageEntry"]')) {
message.click();
var spans = document.querySelectorAll('span');
[].forEach.call(spans, function(span) {
if (span.innerHTML == "Delete") {
span.click();
}
});
}
@Eskuero
Eskuero / roomservice.xml
Created August 11, 2019 01:57
Barebones LineageOS manifest
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="33bca/android_device_xiaomi_daisy" path="device/xiaomi/daisy" remote="github" />
<project name="33bca/android_kernel_xiaomi_msm8953" path="kernel/xiaomi/msm8953" remote="github" />
<project name="33bca/android_vendor_xiaomi_daisy" path="vendor/xiaomi/daisy" remote="github" />
<project name="Eskuero/patches_lineageos" path="patches" remote="github" />
<project name="LineageOS/android_packages_resources_devicesettings" path="packages/resources/devicesettings" remote="github" />
</manifest>
@Eskuero
Eskuero / nicenessbot.py
Created July 29, 2019 16:42
Source code for Mastodon's nicenessbot @nicenessbot@botsin.space
from mastodon import Mastodon
from bs4 import BeautifulSoup
from random import randint
# Connect to Mastodon with bot token
mastodon = Mastodon(
access_token = 'REPLACE ME',
api_base_url = 'REPLACE ME'
)
@Eskuero
Eskuero / deletealltwitter.js
Last active October 6, 2019 23:50
Updated version of the tweet deleter and retweet undoer for the 2019 version of Twitter.
var deleteall = async function() {
console.log("Undoing Retweets")
// Keep iterating until there's no retweet to do
while (retweet = document.querySelector('[data-testid="unretweet"]')) {
console.log(retweet)
retweet.click();
// Sleep a bit to make sure the confirm prompt appeared
await new Promise(r => setTimeout(r, 1000));
document.querySelector('[data-testid="unretweetConfirm"]').click()
// Sleep a bit again to make sure the tweet is unspawned from view