Skip to content

Instantly share code, notes, and snippets.

View djromero's full-sized avatar
⌨️
Working

Julián Romero djromero

⌨️
Working
  • Job&Talent
  • Madrid (Spain)
View GitHub Profile
@djromero
djromero / perfectelementary.bash
Created June 6, 2016 10:28
HowTo Install the perfect Elementary-OS
#Download Elementary OS from here:
#http://sourceforge.net/projects/elementaryos/files/stable/
#First you update your system
sudo apt-get update && sudo apt-get dist-upgrade
#Install Google Chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
@djromero
djromero / channel.swift
Last active January 18, 2018 22:31 — forked from seanlilmateus/channel.swift
golang like channels in swift
import XCPlayground
import Foundation
import UIKit
class Channel<T>
{
var stream: Array<T>
let queue: dispatch_queue_t
let semaphore: dispatch_semaphore_t
@djromero
djromero / Tuple+Generator.swift
Created January 31, 2016 18:12 — forked from jverkoey/Tuple+Generator.swift
Tuple enumeration
/** The returned generator will enumerate each value of the provided tuple. */
func generatorForTuple(tuple: Any) -> AnyGenerator<Any> {
return anyGenerator(Mirror(reflecting: tuple).children.lazy.map { $0.value }.generate())
}
// Blogged at http://design.featherless.software/enumerating-tuple-values-swift/
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev libffi-dev libjemalloc-dev
apt-get -y install autoconf curl bzip2
apt-get -y autoremove
apt-get -y clean
cd /usr/local/src
curl http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
@djromero
djromero / xcode_uuid.sh
Created November 4, 2015 10:48
Xcode UUID
defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID
@djromero
djromero / pre-commit
Last active December 2, 2015 16:50
Git pre-commit hook to detect debugging stuff that shouldn't be commited.
#!/bin/sh
# commit without hook:
# git commit --no-verify
#
declare -i REJECTED
REJECTED=0
red="\033[31m"
reset="\033[m"
@djromero
djromero / psql.rb
Created April 14, 2015 21:38
Write the psql command for a .env line in URL format.
#!ruby
# Usage:
# ruby psql.rb <VAR_NAME>
#
require 'URI'
name = ARGV[0]
starts_with_name = Regexp.new('^' + name)
uri = nil
@djromero
djromero / monitor-page.sh
Last active February 11, 2018 22:53
Send email and tweet when a web page changes in bash.
#!/bin/bash
# inspired in "Monitoring a web page for changes using bash"
# http://bhfsteve.blogspot.com.es/2013/03/monitoring-web-page-for-changes-using.html
# monitor.sh - Monitors a web page for changes
# sends an email notification and a tweet if the file changes
# requirements:
# - twitter from the command line [https://github.com/sferik/t]
# gem install t
# - sendemail
@djromero
djromero / ipify.sh
Last active August 29, 2015 14:16
Copy current external IP address in #mac Terminal
curl -s 'http://api.ipify.org' | pbcopy
@djromero
djromero / netcat-forward-port
Last active August 29, 2015 14:16
Port forwarding with netcat
# forward port YYYY to remote-host:XXXX
forwarder-host$ mkfifo fifo_port_XXXX
forwarder-host$ nc -k -l YYYY 0<fifo_port_XXXX | nc remote-host XXXX 1>fifo_port_XXXX
# now we can access remote-host:XXXX in a machine with access only thru forwarder-host
local-host$ curl forwarder-host:YYYY
<output from remote-host server>