Skip to content

Instantly share code, notes, and snippets.

@myles
myles / README.md
Last active Sep 15, 2020
Colly & Go vs. BeautifulSoup & Python
View README.md

Colly & Go vs. BeautifulSoup & Python

> time go run cryptocoinmarketcap.go
2017/12/19 17:26:38 Scraping finished, check file "cryptocoinmarketcap-go.csv" for results
        2.24 real         0.84 user         0.45 sys

> time python3 cryptocoinmarketcap.py
WARNING:root:Scraping finished, check file cryptocoinmarketcap-py.csv for results
 3.51 real 2.94 user 0.07 sys
@myles
myles / csv_spliter.py
Last active Aug 14, 2017
Quick Python script for splitting large CSV files using Pandas and NumPy.
View csv_spliter.py
#!/usr/bin/env python3
import argparse
import math
import os.path
import pandas as pd
import numpy as np
def main(filepath):
@myles
myles / fabfile.py
Created Jul 11, 2017
Fabric File for deploying a Laravel website
View fabfile.py
import datetime
from fabric.api import cd, env, task, run
from fabric.contrib.project import rsync_project
from fabric.utils import puts
env.hosts = ['127.0.0.1']
env.user = 'serverpilot'
env.app_dir = '~/apps/laravel/'
env.releases_dir = '~/.releases/laravel'
@myles
myles / fabfile.py
Created Jun 27, 2017
Trellis Fabric File for Transferring Production to Staging
View fabfile.py
import datetime
import yaml
from ansible_vault.api import Vault
from fabric.api import env, execute, get, local, put, run, task
env.user = 'root'
env.now = datetime.datetime.now().strftime('%Y-%m-%dT%H-%M-%S')
env.roledefs = {
@myles
myles / happy_valentines_day.py
Last active Feb 14, 2017
happy_valentines_day.py
View happy_valentines_day.py
#!/usr/bin/env python3
import argparse
def encode(secret):
binary = bin(int.from_bytes(secret.encode(), 'big'))
return binary[2:].replace('0', '❤️').replace('1', '💜')
def decode(code):
@myles
myles / App.js
Created Jan 26, 2017
Playing around with WordPress REST API and React
View App.js
import WordPress from 'wpcom';
import { css } from 'glamor'
import React from 'react';
let PostStyle = css({
borderBottomColor: '#ccc',
borderBottomStyle: 'solid',
borderBottomWidth: '1px',
margin: '1em 0',
View gist:9a0785b3d37c615fe631d3f34eb4cd36
<html>
<head><title>Fuzzy Search</title>
<script id="algorithm">
// YOUR CODE HERE !
</script>
@myles
myles / Makefile
Created Aug 22, 2016 — forked from toolmantim/Makefile
An example of using Make instead of Grunt for fast, simple and maintainable front-end asset compilation.
View Makefile
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
@myles
myles / pptx-to-png.sh
Last active Nov 9, 2017
Convert a bunch of PowerPoint files to PNG files.
View pptx-to-png.sh
for pptx in *.pptx;
do
libreoffice --headless --convert-to pdf $pptx
convert -density 400 `basename $pptx`.pdf -resize 2000x1500 `basename $pptx`%d.jpg
rm `basename $pptx`.pdf
done
@myles
myles / playing.py
Last active Feb 5, 2019
Get the current track playing in iTunes on OS X
View playing.py
#!/usr/bin/env python3
import subprocess
def osascript(script):
"""
This is a bridge between Python and AppleScript using the `osascript`
comamnd line app.
"""