Skip to content

Instantly share code, notes, and snippets.

View jccorrea's full-sized avatar

Julio Cesar Correa jccorrea

  • Sao Paulo,Brazil
View GitHub Profile
https://scapy.readthedocs.io/en/latest/
http://bt3gl.github.io/black-hat-python-infinite-possibilities-with-the-scapy-module.html
@jccorrea
jccorrea / gist:ad6f730cb420244ffd1cd9a301539ee4
Created July 6, 2017 18:19
give read + write permission - Linux directory
chmod -R a+rw jccdir/
@jccorrea
jccorrea / gist:09ac63f16c4be08544dbcca11b6aae13
Created June 23, 2017 02:15
pandas - drop + rename column
print(df.head())
#print(df.drop(df[df['Quantity'] == 0].index))
print((df.drop(df[df['Quantity']== 0].index)
.rename(columns={'Weight':'Weight(oz.)'})
))
* * * * * command to be executed
┬ ┬ ┬ ┬ ┬
│ │ │ │ │
│ │ │ │ │
│ │ │ │ └───── day of week (0 - 7) (0 or 7 are Sunday, or use names)
│ │ │ └────────── month (1 - 12)
│ │ └─────────────── day of month (1 - 31)
│ └──────────────────── hour (0 - 23)
└───────────────────────── min (0 - 59)
@jccorrea
jccorrea / gist:611b90c8859ae0b1a19336b88bd3be4c
Created April 17, 2017 17:42
sed - limpar arquivo a partir da linha x com conteúdo y
cat teste.csv | sed -e '2,${ /^| x.ddd /d }' > testeclean.csv
@jccorrea
jccorrea / gist:acbf855bae96450aec3e280d4cd8d091
Created April 13, 2017 19:01
clone spark.properties via shell
for i in 03 04 05 06 07 08 09 10 11 12 13; do cp 11_spark_conf.properties "${i}_spark_conf.properties"; done
@jccorrea
jccorrea / gist:12ef319e475d28b9a2baf0cddd70dc6d
Last active March 29, 2017 18:24
vi : add spaces for n lines
I'd use :%s/^/ /
You could also specify a range of lines :10,15s/^/ /
Or a relative range :.,+5s/^/ /
#credits to "luser droogs"
@jccorrea
jccorrea / export_variables_from_file.sh
Created March 29, 2017 18:22
Unix/Linux - export variables from file
set -a
. tmp.txt
set +a
# credits to Stéphane Chazelas
@jccorrea
jccorrea / write_single_csv.py
Created March 25, 2017 01:05
Spark - write single CSV file by Richard Garris
df.coalesce(1).write.format("com.databricks.spark.cvs").save("...path...")
#copy this file to local machine
dbutils.fs.cp("...path...", "..path.. ..csv")
@jccorrea
jccorrea / gist:08f9a2928af6af8483df9dda12e9b447
Created March 25, 2017 01:02
append header to text file . by Dennis Williamson
echo 'task goes here' | cat - todo.txt > temp && mv temp todo.txt
or
sed -i '1s/^/task goes here\n/' todo.txt
or
sed -i '1itask goes here' todo.txt