Skip to content

Instantly share code, notes, and snippets.

View marcosvidolin's full-sized avatar
🎯
Always learning

Marcos Vidolin 👾 marcosvidolin

🎯
Always learning
View GitHub Profile
@marcosvidolin
marcosvidolin / table_bkp.sql
Last active August 3, 2019 15:41
How to Backup a table on Oracle
create table my_backup_table as (select * from my_table);
@marcosvidolin
marcosvidolin / docker-route.sh
Last active August 3, 2019 15:32
Remove Docker router (gateway)
# 1- ver qual a rota do docker com o comando
route
# 2- remover a rota
sudo route del -net 172.17.0.0 netmask 255.255.0.0
@marcosvidolin
marcosvidolin / kill_port_process.sh
Last active June 8, 2021 10:34
Linux: How to list and kill a process using a port
# to list all ports that are used
sudo netstat -ntlp | grep LISTEN
# you can obtain a specific port using the following command
sudo netstat -ntlp | grep :8080
# when you execute the command above you will see something like that
tcp 0 0 0.0.0.0:27370 0.0.0.0:* LISTEN 4394/skype
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN 2216/dnsmasq
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 4912/cupsd
@marcosvidolin
marcosvidolin / watch.sh
Created November 19, 2013 16:02
Repeat command automaticaly
# Usage: watch [-dhntv] [--differences[=cumulative]] [--help] [--interval=<n>] [--no-title] [--version] <command>
# -d, --differences[=cumulative] highlight changes between updates
# (cumulative means highlighting is cumulative)
# -h, --help print a summary of the options
# -n, --interval=<seconds> seconds to wait between updates
# -v, --version print the version number
# -t, --no-title turns off showing the header
#
#
# example:
@marcosvidolin
marcosvidolin / appcfg.update.sh
Created November 13, 2013 23:01
How to deploy a Google AppEngine application?
# %APPENGINE_HOME%/appcfg.sh update "WAR_PATH"
# Enter your Google username and password at the prompts.
# see: https://developers.google.com/appengine/docs/java/gettingstarted/uploading
/opt/appengine-java-sdk-1.8.0/bin/appcfg.sh update target/gae-springmvc-template-0.0.1-SNAPSHOT
@marcosvidolin
marcosvidolin / copy.data.sql
Created November 11, 2013 12:31
Cópia de dados entre duas tabelas
Este comando efetua a cópia de dados entre duas tabelas dentro de um mesmo banco, ou entre bancos diferentes.
Muito útil para equalizar dados para testes, simulações de erros, etc...
A sintaxe é:
COPY FROM <db> TO <db> <opt> <tbl> {<<cls>>} USING <sel>
Onde:
<db> : string de banco de dados, ex.: usuário/senha@banco1
<opc>: Uma das palavras chaves: APPEND, CREATE, INSERT ou REPLACE
@marcosvidolin
marcosvidolin / crontab.sh
Created November 1, 2013 00:18
Crontab edition
# To use cron for tasks meant to run only for your user profile, add entries to
# your own user's crontab file. Start the crontab editor from a terminal window:
$crontab -e
# Commands that normally run with administrative privileges (i.e. they are
# generally run using sudo) should be added to the root user's crontab (instead of the user's crontab):
$sudo crontab -e
# see:
# https://help.ubuntu.com/community/CronHowto
@marcosvidolin
marcosvidolin / sdcard.image.sh
Created October 30, 2013 20:32
How to make a SD card image using command line
dd if=/dev/sdb of=imagem.img bs=1MB
of = output
if = input
bs = Block Size
example (tested):
# to make an image
sudo dd if=/dev/mmcblk0 of=~/Desktop/image.iso bs=1MB
@marcosvidolin
marcosvidolin / iterating.a.map.java
Created October 30, 2013 02:23
Iterating a map
Map modelMap = model.asMap();
for (Object modelKey : modelMap.keySet()) {
Object modelValue = modelMap.get(modelKey);
System.out.println(modelKey + " -- " + modelValue);
}
@marcosvidolin
marcosvidolin / glassfish-embedded.txt
Created September 24, 2013 18:58
Maven- To run glassfish embedded
mvn org.glassfish:maven-glassfish-plugin:run