Skip to content

Instantly share code, notes, and snippets.

pull-ppa-source -d --ppa SOURCE_PPA SOURCE_PACKAGE UBUNTU_VERSION FULL_PACKAGE_VERSION # download orig and debian
# unpack both
# mv debian -> extracted .orig archive
cd YOUR_EXTRACTED_ARCHIVE
dch -i # edit the changelog, bump non-semver
sudo apt-get build-dep . # install build deps
dpkg-buildpackage -S -sa -k"$KEY_ID" # build source package. `-sa` super important! Else the .orig wont be added to the upload/changes file. This assumes you imported your gpg private/public and KEY_ID is your gpg key id
dput --debug YOUR_PPA YOUR_CHANGES_FILE
@Hook25
Hook25 / makeswapfile.sh
Created May 29, 2024 08:01
creates a swap file for $SIZE size
#!/bin/bash
set -e
sudo fallocate -l $SIZE swapfile
sudo chmod 600 swapfile
sudo mkswap swapfile
sudo swapon swapfile
#!/bin/bash
# somtimes the terminal breaks when closing an application, this fixes it
stty sane
#this is very crude, keep this in mind before including it in production and relying on it
#it is WAY faster
if 'linux' in sys.platform:
from shutil import copytree
else:
def copytree(src, dst):
"""DOES NOT sanitize input"""
import os
src = os.path.normpath(src)
dst = os.path.normpath(dst)
s = Array.from(document.getElementsByClassName("btnCalculate")).map( x => parseInt(x.parentNode.getElementsByClassName('white')[0].innerText.replaceAll(',',''))).reduce( (t, x) => t+x )
container = document.createElement('span')
container.class = 'silver'
txt = ""
s_txt = s + ""
for(let c = 0; c < s_txt.length; c++){
if(c != 0 && ((s_txt.length - c) % 3 == 0)){
txt += ","
}
txt += s_txt[c]
let interactive_script = true;
function call_evt_onchange(element){
if ("createEvent" in document) {
let evt = document.createEvent("HTMLEvents");
evt.initEvent("change", false, true); //random DOM garbage
element.dispatchEvent(evt);
} else {
element.fireEvent("onchange");
}
}
@Hook25
Hook25 / menu.py
Created October 31, 2017 14:14
Menù Povo
from bs4 import BeautifulSoup as bs
import requests
def main():
try:
r = requests.get('https://saporidigastronomia.wordpress.com/blog/')
soup = bs(r.text, 'html.parser')
articles = soup.findAll('article')
art = bs(str(articles[0]), 'html.parser')
plates = art.findAll('li')