Skip to content

Instantly share code, notes, and snippets.

View DanielRamosAcosta's full-sized avatar
🫒
Working from Jaén

Daniel Ramos DanielRamosAcosta

🫒
Working from Jaén
View GitHub Profile
#!/bin/bash
# if not root, run as root
if (( $EUID != 0 )); then
sudo /update/update.sh
exit
fi
apt update
apt -y upgrade
apt -y dist-upgrade
apt clean
@DanielRamosAcosta
DanielRamosAcosta / es6ajax.js
Created May 20, 2016 19:08
ECMAScript6 native AJAX
fetch('https://restcountries.eu/rest/v1/name/spain').then((res) => {
return res.json();
}).then((data) => {
console.log(data);
})
{
"black": "#282a36",
"dark_blue": "#66d9ef",
"dark_green": "#a6e22e",
"dark_cyan": "#a1efe4",
"dark_red": "#f92672",
"dark_magenta": "#ae81ff",
"dark_yellow": "#fd971f",
"gray": "#f5f4f1",
"dark_gray": "#383830",
@DanielRamosAcosta
DanielRamosAcosta / Dockerfile
Created November 16, 2016 01:11
Miencraft server dockerfile
FROM openjdk:8
RUN apt-get update
RUN apt-get install -y nginx openssh-server git-core openssh-client curl
RUN apt-get install -y nano
RUN apt-get install -y build-essential
RUN apt-get install -y openssl libreadline6 libreadline6-dev curl zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
RUN command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
RUN \curl -L https://get.rvm.io | bash -s stable
@DanielRamosAcosta
DanielRamosAcosta / Dockerfile
Created November 30, 2016 01:35
Base de datos PostgreSQL junto con pgweb usando Docker
# docker build -t postgresql .
# docker run -d -p 0.0.0.0:5432:5432 --name postgresql_inst_1 postgresql
FROM ubuntu
ARG usuario=usuario
ARG password=password
ARG database=database
RUN apt-get update
@DanielRamosAcosta
DanielRamosAcosta / functionaltsv.js
Created December 4, 2016 03:03
Functional Javascript example.
const http = require('http')
const fetch = uri => new Promise(resolve =>
http.get(uri, res => {
res.setEncoding('utf8')
let data = ''
res.on('data', chunk => data += chunk)
res.on('end', () => resolve(data))
})
)
@DanielRamosAcosta
DanielRamosAcosta / empty.py
Last active February 6, 2017 16:41
Vacía peliculas para que no ocupen especio pero se quedan como placeholder
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse, os, re, sys
MIN_MOVIE_SIZE = 5
pattern = re.compile('.*\.(mkv|avi|mp4)$')
parser = argparse.ArgumentParser(description='Vacía peliculas para que no ocupen especio pero se quedan como placeholder.')
import React, { Component, PropTypes } from 'react'
import { StyleSheet, Text, View } from 'react-native'
import Router from 'react-router/MemoryRouter'
import {Link, Route} from 'react-router-native'
export default class App extends Component {
render () {
return (
<Router>
@DanielRamosAcosta
DanielRamosAcosta / data.txt
Last active July 22, 2017 17:02
Elixir functional example
mark johansson waffle iron 80 2
mark johansson blender 200 1
mark johansson knife 10 4
Nikita Smith waffle iron 80 1
Nikita Smith knife 10 2
Nikita Smith pot 20 3
package main
import (
"fmt"
)
func main() {
intSlice := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
for _, number := range intSlice {