Skip to content

Instantly share code, notes, and snippets.

Avatar

Julio Cesar Correa jccorrea

  • Sao Paulo,Brazil
View GitHub Profile
View Scapy
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 Jul 6, 2017
give read + write permission - Linux directory
View gist:09ac63f16c4be08544dbcca11b6aae13
print(df.head())
#print(df.drop(df[df['Quantity'] == 0].index))
print((df.drop(df[df['Quantity']== 0].index)
.rename(columns={'Weight':'Weight(oz.)'})
))
View gist:c161b107a17761ada77c620a18c5b75b
* * * * * 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 Apr 17, 2017
sed - limpar arquivo a partir da linha x com conteúdo y
View gist:611b90c8859ae0b1a19336b88bd3be4c
cat teste.csv | sed -e '2,${ /^| x.ddd /d }' > testeclean.csv
View gist:acbf855bae96450aec3e280d4cd8d091
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
View gist:12ef319e475d28b9a2baf0cddd70dc6d
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 Mar 29, 2017
Unix/Linux - export variables from file
View export_variables_from_file.sh
set -a
. tmp.txt
set +a
# credits to Stéphane Chazelas
@jccorrea
jccorrea / write_single_csv.py
Created Mar 25, 2017
Spark - write single CSV file by Richard Garris
View write_single_csv.py
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 Mar 25, 2017
append header to text file . by Dennis Williamson
View gist:08f9a2928af6af8483df9dda12e9b447
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