Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Diederikjh
Diederikjh / copysystemdrive.sh
Created January 18, 2017 10:09
Copy system drive and ready to chroot.
# First sync old root then rew root.
# Mostly from http://askubuntu.com/a/3409/41258
sudo rsync -avP --numeric-ids --exclude='/dev' --exclude='/proc' --exclude='/sys' --exclude='/home' --exclude='/media' --exclude='/var/cache/zoneminder' /media/ubuntu/eb636436-ea9f-4e1b-bc71-5b46eb6e96a1/ /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6/
sudo mkdir /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6/proc
sudo mount -B /proc /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6/proc
sudo mkdir /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6/dev
sudo mount -B /dev /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6/dev
@Diederikjh
Diederikjh / AlphawaveIntervewProcess.py
Last active May 22, 2019 18:13
Alphawave Interview process pseudocode
# NOTE THIS CODE CONTAINS NO BUGS
# see https://www.alphawave.co.za/ for more
def InterviewForEMSS( candidate ):
if (goodCV(candidate) == true):
if (onlineTestPass(candidate) == true):
if (faceToFaceInterviewPerformance(candidate) >= 95%):
# ;) https://xkcd.com/292/
goto: Hire
goto: Not-Hire
@Diederikjh
Diederikjh / downloadComp.sh
Last active August 29, 2015 14:06
Bash script for downloading files off video sharing site YouTube
#!/bin/bash
if /home/drbergie/scripts/isAfterHoursDownloadTime.py; then
echo "starting download"
DOWNLOAD_PROGRESS_FILE=/tmp/downloadInProgress
LINKS_FILE=/home/drbergie/youtubelinks.txt
if [ ! -f $DOWNLOAD_PROGRESS_FILE ] ; then
echo "1" > $DOWNLOAD_PROGRESS_FILE
@Diederikjh
Diederikjh / isAfterHoursDownloadTime.py
Last active August 29, 2015 14:06
Check if time is in WebAfrica afterhours download time.
#!/usr/bin/python
import datetime
import sys
now = datetime.datetime.now()
nowTime = now.time()
downloadTimeStart = datetime.time(0,0)
downloadTimeEnd = datetime.time(6,0)