Skip to content

Instantly share code, notes, and snippets.

View michaelluk's full-sized avatar

Michael Luk michaelluk

  • Hong Kong, Earth
View GitHub Profile
@michaelluk
michaelluk / install-docker-compose.sh
Last active July 13, 2019 05:47
raspberry pi 3b+ install docker-compose
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
# solve TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
python -m pip uninstall pip && sudo apt install python-pip --reinstall
sudo pip install docker-compose

Installing Python 3.7.0 on Raspbian

As of July 2018, Raspbian does not yet include the latest Python release, Python 3.7.0 This means we will have to build it ourselves, and here is how to do it.

  1. Install the required build-tools (some might already be installed on your system).
@michaelluk
michaelluk / s3arangodb.sh
Created February 7, 2018 08:33 — forked from faruken/s3arangodb.sh
backup arangodb to S3
#!/bin/sh
# Slightly modified to meet ArangoDB's needs. https://github.com/lumerit/s3-shell-backups
NOWDATE=`date +%Y-%m-%d`
LASTDATE=$(date +%Y-%m-%d --date='1 week ago')
USERNAME="${ARANGODB_USERNAME}"
PASSWORD="${ARANGODB_PASSWORD}"
DATABASE='dbname'
@michaelluk
michaelluk / _README.md
Created August 31, 2017 03:38 — forked from schickling/_README.md
Script to import and export docker-machine configurations to sync between hosts/collaborators

docker-machine import/export

Script to import and export docker-machine configurations to sync between hosts/collaborators

Export (on host A)

$ docker-machine ls
NAME       ACTIVE   DRIVER         STATE     URL                            SWARM   DOCKER    ERRORS
dev        -        digitalocean   Running   tcp://example.com:2376                 v1.10.1
@michaelluk
michaelluk / index.ios.js
Created July 3, 2017 04:07 — forked from ronnyhartenstein/index.ios.js
React Navigation: Parallel Navigators in React Native in a nutshell
import React from 'react'
import { AppRegistry } from 'react-native'
import setup from './setup'
AppRegistry.registerComponent('ReactNavigationTest', setup)
@michaelluk
michaelluk / huoche.py
Created May 18, 2016 03:59 — forked from w4lle/huoche.py
12306抢票
# -*- coding: utf-8 -*-
"""
@author: Akagi201
"""
from splinter.browser import Browser
from time import sleep
import traceback
###容错做的不好,考虑的情况也不够多,大家见谅
@michaelluk
michaelluk / Foreground.java
Last active August 29, 2015 14:08 — forked from steveliles/Foreground.java
Detect android application enters background and foreground. But it requires API 14+ :\
package com.sjl.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import java.util.List;
@michaelluk
michaelluk / scrapy_osx.sh
Created August 8, 2014 06:27
install scrapy on mac osx 10.9+ (tested on 10.9 & 10.10)
# https://cryptography.io/en/latest/installation/#using-your-own-openssl-on-os-x
brew install pkg-config libffi
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/
brew install openssl
env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography
pip install cryptography
pip install Scrapy
@michaelluk
michaelluk / scrapy_ec2.sh
Created August 8, 2014 06:26
install scrapy aws ec2
# https://cryptography.io/en/latest/installation/#building-cryptography-on-linux
sudo yum install gcc libffi-devel python-devel openssl-devel
pip install Scrapy
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>