Skip to content

Instantly share code, notes, and snippets.

View pvilas's full-sized avatar
💭
Working on a financial webservice idea

Pere Vilas pvilas

💭
Working on a financial webservice idea
  • Cálida Ibiza, SA
  • Eivissa Ibiza (Spain)
View GitHub Profile
@pvilas
pvilas / grafs-pac2.ipynb
Created November 18, 2019 13:16
Grafs-PAC2.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pvilas
pvilas / pac1.ipynb
Created October 21, 2019 14:54
PAC1.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pvilas
pvilas / pac1.ipynb
Created October 21, 2019 14:46
PAC1.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pvilas
pvilas / dns-sd.md
Created September 17, 2019 08:08
Apunts de dns-sd

Anunciar un servei fake

dns-sd  \
   -R "A Fake Announcement to Register a Dummy HTTP Server" \
   _http._tcp,_universal \
   .   \
   8081

Chequear si hi ha s'anunci

@pvilas
pvilas / radius-vlan.md
Last active September 9, 2019 11:06
Radius VLAN info on Accept message

From https://documentation.meraki.com/MR/Client_Addressing_and_Bridging/RADIUS_Override:

A RADIUS server has the ability to send VLAN information to the AP in RADIUS Access Accept messages. To send VLAN information, three required RADIUS attributes must be configured in your RADIUS policy:

  • Tunnel-Type: Choose Attribute value Commonly used for 802.1X and select Virtual LANs (VLANs).
  • Tunnel-Medium-Type: Choose 802 (Includes all 802 media plus Ethernet canonical format) for the Attribute value Commonly used for 802.1X.
  • Tunnel-Private-Group-ID: Choose String and enter the VLAN desired (ex. "500"). This string will specify the VLAN ID 500.

Sample FreeRADIUS user configuration (/etc/freeradius/3.0/users):

@pvilas
pvilas / list_to_comma.py
Created February 26, 2019 09:30
Convert a list into a comma separated string
", ".join(map( lambda x: str(x), labels)
@pvilas
pvilas / mysql-date-functions.sql
Created January 16, 2019 11:45
Mysql utility date functions
delimiter //;
CREATE FUNCTION `first_day_month`(dt datetime) RETURNS date
COMMENT 'Returns the first day of the month of the date'
BEGIN
RETURN DATE_ADD(DATE_ADD(LAST_DAY(dt),
INTERVAL 1 DAY),
INTERVAL - 1 MONTH);
END//
@pvilas
pvilas / install-mysql-python-drivers-ubuntu.md
Last active December 14, 2018 09:30
Install python mysqldrivers for python3
@pvilas
pvilas / opencv_test.cpp
Last active September 20, 2017 16:18
compile opencv 3.3 sourcecode
# taken from
# http://answers.opencv.org/question/25642/how-to-compile-basic-opencv-program-in-c-in-ubuntu/
# http://answers.opencv.org/question/46755/first-example-code-error/
g++ -I/usr/local/include/opencv -I/usr/local/include -L/usr/local/lib/ -g -o output opencv_test.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_stitching -lopencv_imgcodecs -lopencv_cudafeatures2d -lopencv_xfeatures2d
@pvilas
pvilas / install-opencv-cuda.sh
Created September 18, 2017 12:22
Installing OpenCV CUDA and python3 (Tested on AWS p2.xlarge and Deep Learning Ubuntu AMI 22_Aug_2017)
echo "First, you must manually donwload CUDA8 from https://developer.nvidia.com/cuda-downloads"
echo "Ideas taken from https://github.com/BVLC/caffe/wiki/OpenCV-3.2-Installation-Guide-on-Ubuntu-16.04 and http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/"
echo "Installing Nvidia drivers"
# Start clean
sudo apt purge nvidia-*
# Add the PPA
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt-get install nvidia-367