blocks = []
while True:
block = f.read(32)
if block == '':
break
blocks.append(block)
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
zip myfiles d0 | |
(cd f1; zip -u ../myfiles.zip d1) | |
(cd f2/f3; zip -u ../../myfiles.zip d4) | |
# example | |
# zip project3.zip -j a/*.hdl | |
# (cd b; zip -u ../project3.zip *.hdl) | |
# The parentheses create subshells, and the effect of the cd only lasts in the subshell, | |
# so you don't have to cd back to the original directory. |
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
#!/usr/bin/env bash | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
git clone https://github.com/1tayH/noisy.git && cd noisy | |
readonly __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
curl -sSL "http://s3.amazonaws.com/alexa-static/top-1m.csv.zip" | tar xvfz - -C ${__dir} | |
python - <<EOF | |
import json | |
import csv |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <unistd.h> | |
#include <sys/personality.h> | |
#include <sys/utsname.h> | |
#define UNAME26 0x0020000 |
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 | |
# check for root first | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root" | |
exit | |
fi | |
# update local packages | |
apt update |
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
readonly CHAT_HOME=/opt/Rocket.Chat | |
readonly DOMAIN=[FILL-ME] | |
readonly WEBMASTER_MAIL=[FILL-ME] | |
# MongoDB | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 | |
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list | |
# Node.js | |
apt-get update -yq && apt-get install -yq curl && curl -sL curl -sL https://deb.nodesource.com/setup_8.x | sudo bash - | |
# Install deps | |
apt-get install -yq build-essential mongodb-org nodejs graphicsmagick |
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
# add PHP+Certbot repo | |
add-apt-repository ppa:certbot/certbot -y | |
apt-add-repository ppa:ondrej/php -y | |
# update + upgrade | |
DEBIAN_FRONTEND=noninteractive apt-get -yq update && apt-get -yq upgrade | |
# set time + locale | |
timedatectl set-timezone Europe/Budapest | |
locale-gen en_US en_US.UTF-8 | |
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 | |
# enable auto-update |
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
# Install requirements | |
apt-get install -y build-essential | |
apt-get install -y checkinstall | |
apt-get install -y libreadline-gplv2-dev | |
apt-get install -y libncursesw5-dev | |
apt-get install -y libssl-dev | |
apt-get install -y libsqlite3-dev | |
apt-get install -y tk-dev | |
apt-get install -y libgdbm-dev | |
apt-get install -y libc6-dev |
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 | |
############################################### | |
# To use: | |
# chmod +x install-redis.sh | |
# ./install-redis.sh | |
############################################### | |
version=3.2.0 | |
echo "*****************************************" | |
echo " 1. Prerequisites: Install updates, set time zones, install GCC and make" |
You need a shell.