Skip to content

Instantly share code, notes, and snippets.

🏍
...

Maxime Biais maxme

🏍
...
Block or report user

Report or block maxme

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maxme
maxme / raspberry-power-supply-check.sh
Created Feb 2, 2019
Check your Raspberry pi power supply and USB cable
View raspberry-power-supply-check.sh
#!/bin/bash
# Before running this script, make sure you have sysbench installed:
# sudo apt-get install sysbench
#
# This script helps you check if your Raspberry pi is correctly powered.
# You can read more about Raspberry pi powering issues here: https://ownyourbits.com/2019/02/02/whats-wrong-with-the-raspberry-pi/
# If you're pi is correctly powered (stable power supply and quality cable), after running the script, you should get something like:
@maxme
maxme / watch-for-webpage-change-cron.sh
Last active Jan 24, 2019
Set this up in a crontab to check if a webpage changed since last check. It will email you the diff when it happens.
View watch-for-webpage-change-cron.sh
#!/bin/sh
checkIfPageChanged() {
URL="$1"
EMAIL_ADDRESS="$2"
CSS_SELECTOR="$3"
SILENT="$4"
tmpfile1=/tmp/$(echo $URL| sha1sum | cut -d" " -f1)
tmpfile2=$tmpfile1-1
curl -L --silent "$URL" -A "Maxme/1.0 (Watching for changes; https://gist.github.com/maxme/c31ffbb3cb21f3baa6e9c9e61bbe0a72)" \
@maxme
maxme / watch-for-change.sh
Last active Jan 18, 2019
Watch for web page change
View watch-for-change.sh
#!/bin/sh
# Require curl and html-xml-utils
TMPFILE1=$(mktemp)
TMPFILE2=$TMPFILE1-1
function checkIfPageChanged() {
URL="$1"
EMAIL_ADDRESS="$2"
@maxme
maxme / up.sh
Created Nov 30, 2018
Shell script that upload any kind of file to a web server and expect it to webserve the file at https://example.com/uploads/ - The script is made for OS X, as it copy the url to the pasteboard for later use. Main usage of this script is to quickly upload and share a file (image/video/json/etc.).
View up.sh
#!/bin/sh
# Replace the following by your server configuration
UPLOAD_DIR_BASE=/var/www/example.com/uploads/
URLBASE=https://example.com/uploads/
SSH_SERVER=example.com
RAND=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 4 | head -n 1`
UPDIR=UPLOAD_DIR_BASE/$RAND
View SiteModelMapper.java
package com.wellsql.generated;
import com.yarolegovich.wellsql.core.Mapper;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.util.HashMap;
import java.util.Map;
import org.wordpress.android.stores.model.SiteModel;
View gradle2buck-dependencies.sh
deps="$(find . -iname "build.gradle" | xargs grep 'compile ' | grep -v project | sed -E "s/.*'(.*)'.*/\1/" | sort | uniq)"
function printTemplate() {
cat << EOF
remote_file(
name = '$1-file',
out = '$2',
url = 'mvn:$4:$1:aar:$3',
sha1 = '0ec99fae8716984ec56489fb45d1ae752724bae7',
)
View imgscraper.py
import random
import requests
import os
from urllib import request
from bs4 import BeautifulSoup
from multiprocessing import Pool
base_url = "http://imgur.com"
View layout1.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="24dp"
android:paddingRight="16dp">
<View
android:background="@android:color/holo_red_dark"
android:id="@+id/my_site_list_row_empty_icon"
View dashicons-to-png.sh
#!/bin/sh
# Example inputs:
# dashicon_admin_site 
# dashicon_admin_users 
# dashicon_lock 
# dashicon_edit 
# dashicon_email 
if [ x$2 == x ]; then
View how-to-start-development-wpandroid.md

The following guide can be applied on Mac OS X and Linux.

Prerequisites: git and java installed.

  1. Download [Android Studio beta]. It includes: Android Studio (IDE based on Intellij IDEA), the Android SDK, Android tools and an Android emulator. Unzip this archive in a place you like, we're going to refer to the Android Studio directory later by AS_DIR. Note you don't have to use the Android Studio IDE. You can use your favorite editor and the command line build tool (gradle).

     $ export AS_DIR="/home/user/work/Android Studio"
    
  2. Install the Android SDK version 20

You can’t perform that action at this time.