Skip to content

Instantly share code, notes, and snippets.

View Pandry's full-sized avatar

Pandry Pandry

  • Italy
View GitHub Profile
@Pandry
Pandry / amazonListPriceCalculator.js
Last active July 8, 2017 13:13
Little code to paste in the console to get the price of a list on amazon. (You need to open the list than execute the code)
var elementPrice = document.getElementsByClassName("a-size-base a-color-price a-text-bold");
var elementusedprice = document.getElementsByClassName("a-color-price itemUsedAndNewPrice");
var countedItems = 0;
var totalprice = 0.0;
for (var i = 0; i < elementPrice.length; i++){
var price = parseFloat(elementPrice[i].innerText.replace(",",".").substring(4));
if(isNaN(price)){
price = parseFloat(elementusedprice[i].innerText.replace(",",".").substring(4));
}
if(!isNaN(price)){

Keybase proof

I hereby claim:

  • I am pandry on github.
  • I am pandry (https://keybase.io/pandry) on keybase.
  • I have a public key ASAfM4lvh7VvrqjiqUo41Z1kl9nulUMrmSlOYsqtE6cE3go

To claim this, I am signing this object:

#!/bin/bash
##
## fast-run: curl -o install-cloudinit.sh https://gist.githubusercontent.com/Pandry/a24b1b681ea5524157799cb013c1b387/raw/7895d24277abce440fcfd010d7380067b255728e/installCloudinit.sh && chmod +x install-cloudinit.sh && ./install-cloudinit.sh
##
## Author: Pandry (github.com/Pandry)
## Date: 23/10/2018
## Script: CloudInit installer for RHosting.it
## Version: 0.1
##
@Pandry
Pandry / Firewalld GeoIP firewall script
Last active August 11, 2024 12:47
Block countries IPs via Firewalld
#!/bin/bash
##
# Name: GeoIP Firewall script
# Author: Pandry
# Version: 0.1.1
# Description: This is a simple script that will set up a GeoIP firewall blocking all the zones excecpt the specified ones
# it is possible to add the whitelisted zones @ line 47
# Additional notes: Usage of [iprange](https://github.com/firehol/iprange) is suggested
# for best performances
@Pandry
Pandry / certbot autorenewal script
Last active January 14, 2021 09:22
Automatic certbot autorenewal via systemd's timer
cat<<EOF>/etc/systemd/system/certbot-renew.service
[Unit]
Description=Renew Let's Encrypt certificates service
[Service]
Type=oneshot
ExecStart=/usr/bin/certbot renew --post-hook "/usr/bin/systemctl reload nginx" --quiet
#ExecStart=/usr/bin/certbot renew --standalone --pre-hook "/usr/bin/systemctl stop nginx" --post-hook "/usr/bin/systemctl start nginx" --quiet
EOF
@Pandry
Pandry / containerd-ovirt-ga-pipeline.yml
Created March 29, 2019 16:46
A Concourse CI pipeline to build the pipeline
resources:
- name: atomic-containers-repo
type: git
source:
uri: https://github.com/projectatomic/atomic-system-containers.git
branch: master
- name: dockerhub-ovirt-ga
type: docker-image
source:
@Pandry
Pandry / InfluxDB-datapoint-counter.sh
Last active December 4, 2019 15:41
A script to count all the point in a InfluxDB database
#!/bin/bash
##
# Author: github.com/Pandry
# Version: v1.0
##
INFLUXURL="http://127.0.0.1:8086"
#name of the database
DBNAME="telegraf-test"
#host is the tag present on every telegraf measurement
@Pandry
Pandry / bashSpinner.sh
Created December 10, 2019 16:58
A simple script to show a spinner during long tasks in bash
#!/bin/bash
###
# Author: github.com/Pandry
# Version: v1.0
# Description: A simple function to create a spinner while executing a long command
# You can easily add your spinner by putting every "frame" into the spinarr array :)
###
spinner()
@Pandry
Pandry / script.js
Created December 29, 2019 11:23
A script to put on top of casper theme to have .g.svg ending images to be the background of a post
//Taken from https://stackoverflow.com/a/41042412
function colourIsLight(pixel) {
// Counting the perceptive luminance
// human eye favors green color...
pixel[3] = pixel[3]==undefined?255:pixel[3];
var a = 1 - (0.299 * pixel[0] + 0.587 * pixel[1] + 0.114 * pixel[2]) / pixel[3];
return (a < 0.5);
}
function getPropBgImage(e){
@Pandry
Pandry / PHPTester
Last active March 20, 2020 22:30
A script to paste to execute a php webapp quickly (used to play CTF atm)
cat << EOF > docker-compose.yml
version: '3'
services:
php:
build:
context: ./php
# ports:
# - 9000:9000