apt-get update; apt-get upgrade
dphys-swapfile swapoff
dphys-swapfile uninstall
apt-get remove -y --purge wolfram-engine triggerhappy xserver-common lightdm sonic-pi minecraft-pi pigpio
apt-get autoremove -y
These instructions are based on this article: https://www.alexruf.net/2016/05/23/setup-gogs-git-service.html.
Setup Raspberry Pi with minimal Raspbian image. You need to connect to the HDMI port and set the following:
sudo raspi-config
There you need to enable the SSH server and you should change the hostname.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 11/27/2017 - Tweaked for a page redesign. | |
* 1/6/2018 - Handle videos in book bundle. | |
*/ | |
var pattern = /(MOBI|EPUB|PDF( ?\(H.\))?|CBZ)$/i; | |
var pattern2 = /(Download)$/; | |
var nodes = document.getElementsByTagName('a'); | |
var downloadCmd = ''; | |
for (i in nodes) { | |
var a = nodes[i]; | |
if (a && a.text && pattern.test(a.text.trim())) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git remote add upstream https://github.com/some_user/some_repo | |
git fetch upstream | |
git checkout master | |
git reset --hard upstream/master | |
git push origin master --force | |
Keep in mind, that this makes your repo look exactly like upstream - if you have commits, they will be eaten! If you want to update to upstream (but still keep your commits), you want git merge upstream/master. If you want to start a new patch based on upstream, the best way to do it is git checkout -b my-new-feature upstream/master | |
Of course, this all expects you have a remote named upstream, which you can create by doing git remote add upstream https://[upstream guy's repo url] | |
(Just to clarify, the term 'upstream' means the person you forked from) |
This week (May 2017) I have been learning about Docker... Here is what I've learned so far.
The shortcut commands in brackets refer to functions/aliases I've set up in my dotfiles.
sudo apt-get install docker docker-compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd ~ | |
# Install JDK | |
apt update | |
apt install openjdk-8-jre-headless | |
# Install & Start ES 0.90.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Save docker images | |
ds() { | |
docker images | \ | |
cut -d ' ' -f 1 | \ | |
tail -n +2 | \ | |
xargs -t -n 1 -I {} -P 4 \ | |
sh -c 'docker save {} | bzip2 > $(echo "{}" | sed "s/^.*\///").tar.bz2' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let watchify = function() { | |
let watchFrame = Object.assign(document.createElement('div'), {id: 'watch_frame'}); | |
let size = Math.min(document.documentElement.clientWidth, document.documentElement.clientHeight); | |
watchFrame.style.cssText = "position:fixed;width:" + size + "px;height:" + size + "px;top:50%;left:50%;margin-top:-" + size/2 + "px;margin-left:-" + size/2 + "px;box-shadow:0 0 0 99999px #000;border-radius:50%;z-index:2147483647;pointer-events:none"; | |
if (oldWatchFrame = document.getElementById("watch_frame")) { oldWatchFrame.remove() } | |
document.querySelector('body').appendChild(watchFrame); | |
};watchify();window.addEventListener('resize', watchify); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($argc !== 2 || !ctype_digit($argv[1])) { | |
echo "You must specifiy only one parameter: the max number as an integer" . PHP_EOL; | |
exit(1); | |
} | |
$input = (int) $argv[1]; | |
$fizzBuzz = [ |