Skip to content

Instantly share code, notes, and snippets.

@ZiTAL
ZiTAL / TwitterRemoveFavRT.js
Last active Oct 14, 2020
js: Twitter-en erabiltzailien FAV,RT eta SUSTATU-ek kenduteko script-e Tampermonkey add-on-entzat
View TwitterRemoveFavRT.js
// ==UserScript==
// @name TwitterRemoveFavRT
// @namespace TwitterRemoveFavRT
// @description Facebook-en albisteetako erabiltzaileei gonbidamenak automatikoki bidali
// @include https://twitter.com/*
// @include https://*.twitter.com/*
// @grant none
// @version 1
// @license AGPL v3
// ==/UserScript==
@ZiTAL
ZiTAL / clean_words_merged.py
Last active Sep 15, 2020
python3: read xml
View clean_words_merged.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from lxml import etree
import re
file = open("words_merged.xml", "r")
dom = etree.parse(file)
wl = dom.xpath('//wordlist/w')
@ZiTAL
ZiTAL / random-near-numbers.js
Created Jun 19, 2020
js: random near numbers
View random-near-numbers.js
class RandomNearNumbersClass
{
_random(min, max)
{
return Math.floor(Math.random() * (max - min + 1) ) + min;
}
_getMinMax(value, amount, min, max)
{
let _min = value - amount;
@ZiTAL
ZiTAL / 01.sh
Last active Jun 17, 2020
lit-element: webpack example
View 01.sh
mkdir -p /home/projects/lit/src/components
cd /home/projects/lit
npm init -y
npm install lit-element webpack webpack-cli --save-dev
touch index.html
touch src/index.js
touch src/components/progress-bar.js
@ZiTAL
ZiTAL / polymer_cli_install.sh
Last active Jun 17, 2020
js: install polymer-cli globally
View polymer_cli_install.sh
npm install -g polymer-cli --unsafe-perm
@ZiTAL
ZiTAL / promise_loop_timeout.js
Last active Jun 16, 2020
js: Promise loop timeout
View promise_loop_timeout.js
var p = new Promise(function(resolve, reject)
{
resolve();
});
for(var r='', i=0; i<3; i++)
{
(function(_i)
{
p = p.then(function()
@ZiTAL
ZiTAL / index.html
Created Jun 10, 2020
js: count down progress bar
View index.html
<!DOCTYPE html>
<html>
<style>
#myProgress {
width: 100%;
background-color: #ddd;
}
#myBar {
height: 30px;
@ZiTAL
ZiTAL / certificate_renew.sh
Created Jun 9, 2020
apache: letsencrypt auto renew
View certificate_renew.sh
#!/bin/bash
/etc/init.d/apache2 stop
/opt/letsencrypt/letsencrypt-auto renew
/etc/init.d/apache2 start
@ZiTAL
ZiTAL / hosts
Created May 26, 2020
nginx: proxy to local domain
View hosts
# /etc/hosts
127.0.0.1 localhost main.zital main01.zital
@ZiTAL
ZiTAL / speed_test.sh
Last active May 12, 2020
gnu/linux disk speed test
View speed_test.sh
ser=`whoami`
commands="apt-get clean; apt-get update; apt-get upgrade; apt-get dist-upgrade"
if [ $user != "root" ]; then
echo "root needed"
exit 1
fi
dev="/dev/sda"
echo "Write: Cache True 1GB"
You can’t perform that action at this time.