Skip to content

Instantly share code, notes, and snippets.

View diezguerra's full-sized avatar

Saúl diezguerra

View GitHub Profile
@diezguerra
diezguerra / keybase.md
Created February 5, 2016 01:57
keybase.md

Keybase proof

I hereby claim:

  • I am diezguerra on github.
  • I am saul (https://keybase.io/saul) on keybase.
  • I have a public key whose fingerprint is 41CC 20BC 641C 0215 84F8 5736 2F7D 9259 08E9 7490

To claim this, I am signing this object:

@diezguerra
diezguerra / cs_books.md
Created October 20, 2015 17:22
CS books email
@diezguerra
diezguerra / watching.rb
Last active October 20, 2015 17:25
Cagers
# 23 8-18 * * 1-5 curl -L tenwar.com/watching | ruby >/dev/null 2>&1
require('Open3')
if rand(1...10) > 9
osa_script = <<'End'
activate application "Safari"
delay 2
@diezguerra
diezguerra / rot90_o1.py
Created October 17, 2014 05:31
rot90 O(1) space
import numpy as np
arr = np.arange(1, 26).reshape((5, 5))
arr2 = np.arange(1, 26).reshape((5, 5))
def rot90(arr):
for circle in range(len(arr) // 2):
for item in range(0, len(arr) - 1 - 2 * circle):
@diezguerra
diezguerra / cager.sh
Created October 16, 2014 21:35
Cager
curl "http://www.ardemagazine.com/arde/wp-content/uploads/2014/04/1sNE1eX.jpg" > ~/Downloads/caged.jpg
osascript -e "tell application \"System Events\" to set picture of every desktop to \"~/Downloads/caged.jpg\""
@diezguerra
diezguerra / .vimrc
Created October 8, 2014 01:39
Vimrc 10/7/2014
set nocompatible
filetype off
set shell=bash
set rtp+=~/.vim/bundle/vundle
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'kien/ctrlp.vim'
Bundle 'alfredodeza/khuno.vim'
Bundle 'tpope/vim-commentary'
Bundle 'tpope/vim-surround'
@diezguerra
diezguerra / powpow.clj
Created October 6, 2014 18:28
Implementations of power in Clojure
(defn create-power
"Takes a positive power-of implementation and returns a function that uses
it plus the logic for y==0 and y<0"
[implementation]
(fn [x y]
(cond
(> y 0) (implementation x y)
(< y 0) (/ 1 (implementation x (Math/abs y)))
:else 1)))
In = lambda: map(int, raw_input().split())
integer_no, unique_no = In()
a = In()
uniques = [In().pop() for _ in range(unique_no)]
aux = [0] * integer_no
seen = set()
for idx in xrange(integer_no - 1, -1, -1):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import dateutil.parser
import pytz
date_string = '2013-10-14T12:47:12.776270'
date_object = pytz.timezone('America/Los_Angeles').localize(dateutil.parser.parse(date_string))
print date_object.isoformat()