Skip to content

Instantly share code, notes, and snippets.

View danielscarvalho's full-sized avatar
:octocat:
Coding!

Daniel de Souza Carvalho danielscarvalho

:octocat:
Coding!
View GitHub Profile
def getAverage(values):
return sum(values) / float(len(values))
@danielscarvalho
danielscarvalho / isFloat.py
Last active April 1, 2017 02:40
isFloat -> Boolean
def isFloat(value):
return not re.match("^[+-]?\d+?\.\d+?$", value) is None
@danielscarvalho
danielscarvalho / apache.sh
Last active September 22, 2017 19:28
Apaceh Spark BigData
#source
export JAVA_HOME=/opt/jdk1.8.0_144
export SPARK_HOME=/opt/spark-2.2.0-bin-hadoop2.7
export SPARK_DIR=/opt/spark-2.2.0-bin-hadoop2.7
export PYSPARK_PYTHON=python3
export PYSPARK_DRIVER_PYTHON=ipython3
export PYSPARK_DRIVER_PYTHON_OPTS="notebook"
export PATH=$PATH:$SPARK_HOME/bin
pyspark
@danielscarvalho
danielscarvalho / IntelliJ.desktop
Last active December 21, 2021 02:44
Linux icon (Ubuntu)
[Desktop Entry]
Type=Application
Terminal=true
Exec=/opt/idea-IC-203.7717.56/bin/idea.sh
Name=IntelliJ
Icon=/opt/idea-IC-203.7717.56/bin/idea.png
@danielscarvalho
danielscarvalho / softwares.md
Last active March 19, 2022 19:08
Ubuntu Linux setup for developer

Ubuntu Linux setup for developers

Install

  • Wolfram Mathematica
  • Visual Studio Code
  • Brackets
  • git
  • curl
  • JDK (Java)
  • Eclipse
  • MySQL
@danielscarvalho
danielscarvalho / downloadtxt
Last active November 29, 2022 06:02
Git commit automatic message for Linux Bash
#!/bin/bash
# Get the dictionary data file... run it just once...
# put those 3 files at ~/bin directory and give execution permission
cd ~/bin
wget https://www.mit.edu/~ecprice/wordlist.10000 -o wordlist.10000.txt
@danielscarvalho
danielscarvalho / checksslexpire.sh
Last active January 17, 2023 23:12
Check website SSL/TLS cryptography key expiration date
#!/usr/bin/bash
curl -vs https://www.google.com/ 2>&1 | grep "expire date" | cut -c17-50
# Result sounds like: Apr 16 15:52:21 2023 GMT
cd "C:\Program Files\Oracle\VirtualBox\"
VBoxManage.exe modifyvm "Your Virtual Machine Name" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage setextradata "Your Virtual Machine Name" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata "Your Virtual Machine Name" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "Your Virtual Machine Name" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "Your Virtual Machine Name" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "Your Virtual Machine Name" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
@danielscarvalho
danielscarvalho / random_datetime.py
Last active March 13, 2024 17:59
Random Date Time
import numpy as np
def getrandomdatetime():
return str(datetime.fromtimestamp(np.random.randint(0, 2177334732)))