Skip to content

Instantly share code, notes, and snippets.

View mageddo's full-sized avatar
💭
🚲 🍺

Elvis Souza mageddo

💭
🚲 🍺
View GitHub Profile
@mageddo
mageddo / paramiko_example.py
Created October 28, 2017 18:07 — forked from batok/paramiko_example.py
Paramiko example using private key
import paramiko
k = paramiko.RSAKey.from_private_key_file("/Users/whatever/Downloads/mykey.pem")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print "connecting"
c.connect( hostname = "www.acme.com", username = "ubuntu", pkey = k )
print "connected"
commands = [ "/home/ubuntu/firstscript.sh", "/home/ubuntu/secondscript.sh" ]
for command in commands:
print "Executing {}".format( command )
@mageddo
mageddo / paramiko_example.py
Created October 28, 2017 18:07 — forked from batok/paramiko_example.py
Paramiko example using private key
import paramiko
k = paramiko.RSAKey.from_private_key_file("/Users/whatever/Downloads/mykey.pem")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print "connecting"
c.connect( hostname = "www.acme.com", username = "ubuntu", pkey = k )
print "connected"
commands = [ "/home/ubuntu/firstscript.sh", "/home/ubuntu/secondscript.sh" ]
for command in commands:
print "Executing {}".format( command )
@mageddo
mageddo / README.md
Last active October 28, 2017 14:02
Digital Ocean Available Images at 2017-10-28 11:57:00

To get the available images

curl -w '\n'  -H "Authorization: Bearer $TOKEN" https://api.digitalocean.com/v2/images?per_page=999 | python -m json.tool > /tmp/images.json
@mageddo
mageddo / gist:098b666e22655f3a10c835cbe1edf2a2
Created September 10, 2017 17:52 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@mageddo
mageddo / Main.java
Created August 28, 2017 14:08
Encrypt and Decrypt with Streams
public static void main(String[] args) throws Exception {
final Key key = generateSymmetricKey("SecretKey".getBytes());
// encrypting
final Cipher cEncrypter = Cipher.getInstance("DESede/ECB/PKCS7Padding");
cEncrypter.init(Cipher.ENCRYPT_MODE, key);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
try(
CipherOutputStream encrypterStream = new CipherOutputStream(bos, cEncrypter);
package controller
func init(){
Get("/", func(w http.ResponseWriter, r *http.Request){
fmt.Fprintf(w, "%s", "Hi!")
})
}
@mageddo
mageddo / TripleDesBouncyCastle.java
Created August 22, 2017 18:53 — forked from adityasatrio/TripleDesBouncyCastle.java
Triple des bouncy castle.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package asn.helpers;
/**
*
* @author asn
*/
@mageddo
mageddo / _README.md
Created July 28, 2017 20:23 — forked from schickling/_README.md
Script to import and export docker-machine configurations to sync between hosts/collaborators

docker-machine import/export

Script to import and export docker-machine configurations to sync between hosts/collaborators

Export (on host A)

$ docker-machine ls
NAME       ACTIVE   DRIVER         STATE     URL                            SWARM   DOCKER    ERRORS
dev        -        digitalocean   Running   tcp://example.com:2376                 v1.10.1
@mageddo
mageddo / exemplo-tooltipster.html
Last active July 23, 2017 17:25
Tooltip customizado com javascript
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="https://rawgit.com/iamceege/tooltipster/4.2.5/dist/css/tooltipster.bundle.min.css">
<link rel="stylesheet" type="text/css" href="https://rawgit.com/louisameline/tooltipster-follower/0.1.5/dist/css/tooltipster-follower.min.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
<script type="text/javascript" src="https://rawgit.com/iamceege/tooltipster/4.2.5/dist/js/tooltipster.bundle.min.js"></script>
<script type="text/javascript" src="https://rawgit.com/louisameline/tooltipster-follower/0.1.5/dist/js/tooltipster-follower.min.js"></script>
@mageddo
mageddo / ListUtils.java
Created June 21, 2017 22:54
How to make pagination at List in java
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* Reference: https://stackoverflow.com/questions/19688235/how-to-implement-pagination-on-a-list
* @author elvis
* @version $Revision: $<br/>
* $Id: $