Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Hello old friend!

Necronet necronet

👨‍💻
Hello old friend!
View GitHub Profile
@necronet
necronet / bagging.R
Created Aug 7, 2019
Create multiple bagging trees and capture each RSME in order to graph the reduce in variance
View bagging.R
errors <- vector()
for ( i in seq(from = 1, to = 50) ) {
print(paste('Bagging with',i,'trees'))
ames_bag_i <- bagging( formula = Sale_Price ~ ., data=ames_training, nbagg = i, control = rpart.control(minsplit = 2, cp = 0))
errors <- c(errors, ames_bag_i$err)
}
error_df <- as.data.frame(errors)
error_df$n_trees <- 1:nrow(error_df)
ggplot(data = error_df, aes(x = n_trees, y = errors)) + geom_line()
@necronet
necronet / slice_sample.py
Created Oct 18, 2018
Working with slice
View slice_sample.py
# A example on how to use slice in tensorflow, simple but important to remember.
import tensorflow as tf
x = tf.constant([[[1., 2.], [3., 4. ], [5. , 6. ]],
[[7., 8.], [9., 10.], [11., 12.]]])
# All first elements
# [[[ 1.],[ 3.],[ 5.]], [[ 7.],[ 9.],[11.]]]
res = tf.slice(x, [0, 0, 0], [2, 3, 1])
View crawler.py
import requests
import re
from bs4 import BeautifulSoup
#<a href="salud-mental/" class="boton">Ver reportaje</a>
#http://multimedia.laprensa.com.ni/
def trade_spider(max_pagina):
pagina=1;
while pagina <=max_pagina:
url='http://multimedia.laprensa.com.ni/index.html'
crap= requests.get(url)
View currencies.xml
<string-array name="currencies" translatable="false">
<item name="USD">Dollar - $</item>
<item name="MXN">Mexico Peso - $</item>
<item name="COP">Colombian Peso - $</item>
<item name="ARS">Argentine Peso - $</item>
<item name="NIO">Cordoba - C$</item>
<item name="GTQ">Quetzales - Q</item>
<item name="CRC">Colones - ₡</item>
<item name="HNL">Lempira - L</item>
<item name="EUR">Euro - €</item>
View Google cloud
final class PrintDialogJavaScriptInterface {
public String getType() {
return cloudPrintIntent.getType();
}
public String getTitle() {
return cloudPrintIntent.getExtras().getString("title");
}
public String getContent() {
@necronet
necronet / gitignore-drupal
Created Nov 20, 2013
Archivo gitignore para drupal
View gitignore-drupal
#Ignore sass cache
.sass-cache/
#ignore tmp
tmp/
sites/all/default/files/*
#Ignore CSS files from theme (they all autogenerated from sass)
sites/all/themes/ayerdis/css/*
View gist:4982283
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hola a la Web!"
if __name__ == "__main__":
app.run()
View gist:4556442
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<ui:composition template="/WEB-INF/templates/layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
View gist:4059600
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
View gist:1498584
# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
.locals 6
.parameter "savedInstanceState"
.prologue
.line 111
invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V