I hereby claim:
- I am lopespm on github.
- I am lopespm (https://keybase.io/lopespm) on keybase.
- I have a public key ASBVOGTQ7FFo3e2z4-HGjCwpsxKjqroop4en_wFUDWevBwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# (Variant #4 for exercise 11.1 on EPI (Elements of Programming Interviews)) | |
# The rationale behind it to perform a binary search which only considers a given character index of the strings. | |
# If these are present, continue to the next character index. If any of the prefix characters cannot be found in any string, return immediatly | |
# Considering n strings and k prefix length: | |
# Time complexity: O(k * log(n)) | |
# Space complexity: O(1) | |
from typing import List | |
def first(items: List[str], prefix: str, i: int, c: str, left: int, right: int): |
# (Variant for exercise 5.1 on EPI (Elements of Programming Interviews)) | |
# The rationale behind it is to squeeze the forth color (middle right color) in between the middle left and right sub-arrays. It defines the colors as the algorithm progresses. | |
# It has a O(n) time complexity and O(1) space complexity | |
from typing import List | |
def dutch_variant_four_colors(array: List[int]) -> List[int]: | |
left = array[0] | |
mid_left = None | |
right = None |
# Returns the size of the largest binary subtree that is complete, in Python - variant for exercise 9.1 on EPI (Elements of Programming Interviews) | |
# The gist of the solution is to keep track of the subtree's current number of nodes, current height and maximum height until that point. | |
# With the current number of nodes and height, one can calculate the root's own number of nodes and height via its direct childs respective information, | |
# taking into to consideration the relation between the child heights and if they are perfect subtrees or not. | |
# Solution is O(n) time complexity and O(h) space complexity (function call stack corresponds from the root through the unique path to the current node) | |
from collections import namedtuple | |
class BTN(): |
I tried a few different techniques to make a GIF via command-line and the following gives me the best control of quality and size. Once you're all setup, you'll be pumping out GIFs in no time!
Install FFmpeg
Install ImageMagick
const assert = require('assert'); | |
const async = require('async'); | |
const fs = require('fs'); | |
let request = require('request'); | |
const FileCookieStore = require('tough-cookie-filestore'); | |
if (!fs.existsSync('cookies.json')) { fs.writeFileSync('cookies.json', '{}');} | |
let j = request.jar(new FileCookieStore('cookies.json')); | |
request = request.defaults({ jar : j }); |
#!/bin/bash | |
build_folder="build" | |
source_image="source-image.png" | |
mkdir $build_folder | |
convert $source_image -scale 16 $build_folder/16.png | |
convert $source_image -scale 32 $build_folder/32.png | |
convert $source_image -scale 48 $build_folder/48.png |
/* How to Create a userChrome.css File: https://www.userchrome.org/how-create-userchrome-css.html */ | |
/* Dark background color for private browsing tabs, with corresponding lighter text color */ | |
#main-window[privatebrowsingmode="temporary"] #tabbrowser-tabs { | |
/*--tab-line-color: #8000d7 !important;*/ | |
background-color: #000000 !important; | |
color: #ffffff !important; | |
} |
# In OSX, export all your root certicates through Keychain to "Certificates.pem" (for example) | |
openssl s_client -CAfile Certificates.pem -connect learnbreak.com:443 -servername learnbreak.com | openssl x509 -noout -subject -issuer |