Skip to content

Instantly share code, notes, and snippets.

View motatoes's full-sized avatar
🎯
Focusing

Mohamed Habib motatoes

🎯
Focusing
View GitHub Profile
@motatoes
motatoes / backup.sh
Created November 15, 2014 11:19
Self hosted ghost install automated backup script (based on http://www.allaboutghost.com/how-to-automate-backing-up-ghost/)
#!/bin/bash
GHOST_DATABASE=/var/www/ghost/content/data/ghost.db
BACKUP_DIR=/home/ghost/backup/allghostthemes/
BACKUP_RETENTION_PERIOD=10
LOG_FILE=/var/log/backup-allghostthemes.log
DATE=`date '+%Y/%m/%Y-%m-%d-%H-%S'`
# Make backup directory
mkdir -p $BACKUP_DIR$DATE
@motatoes
motatoes / ExtractParliament.js
Last active June 27, 2017 23:31
House of lords info scraping (casperJS)
// == This script extracts emails and other data about the UK house of lords from the following url:
// http://www.parliament.uk/mps-lords-and-offices/mps/
var casper = require('casper').create();
var fs = require('fs');
// This array maintains a list of links to each HOL profile
var links = [];
// This array maintains the scraped information and is saved by the end of this script
### Keybase proof
I hereby claim:
* I am motatoes on github.
* I am motatoes (https://keybase.io/motatoes) on keybase.
* I have a public key ASDmigsAWzs9gaHzX288aWS_XtSCQodImZk0VGy1cx3Towo
To claim this, I am signing this object:
@motatoes
motatoes / stopwatch.vue
Last active April 30, 2021 13:05
quick and dirty stopwatch component for vueJS
<template>
<span id="time" v-html="time"></span>
</template>
<style>
</style>
<script>
module.exports = {
0xb676dF5f50a680fEd1b0915fbF41Af0452566dc3
height = 7
width = 7
board_spaces_occupied = [
[ 1, 0, 1, 1, 1, 0, 0],
[ 1, 1, 0, 1, 1, 0, 1],
[ 1, 1, 1, 1, 0, 0, 1],
[ 1, 0, 1, 0, 1, 1, 1],
[ 1, 0, 0, 1, 1, 1, 1],
[ 0, 0, 1, 0, 0, 1, 1],
[ 0, 1, 1, 0, 1, 1, 1],
@motatoes
motatoes / boxstarter.ps1
Last active December 10, 2017 13:42 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@motatoes
motatoes / gist:81f9dee49923376b7ad032cd3957b797
Last active February 26, 2018 09:31
Tampermonkey Userscript to hide codeforces rankings
// ==UserScript==
// @name CF no ranks
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://codeforces.com/
// @grant none
// ==/UserScript==
@motatoes
motatoes / unlimited.py
Last active March 12, 2018 19:24
script to select n number of ROIs in ropily.py
# import pylab as pl
from matplotlib import pyplot as pl
from matplotlib.widgets import Button
import numpy as np
from roipoly import roipoly
img = np.ones((100, 100)) * range(0, 100)
ROIs = []
fig = pl.Figure()
done = False
@motatoes
motatoes / hist.py
Last active August 29, 2018 22:29
matplotlib hist adjustment
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
np.random.seed(209313920)
x = np.random.randint(1, 4, 500)
# we can see that the histgram x-ticks seems insensible when the
# range of values is small