Skip to content

Instantly share code, notes, and snippets.

@benbonnet
benbonnet / nginx_source_pagespeed_passenger_ubuntu.md
Last active March 9, 2021 16:39
nginx from source with pagespeed and passenger on ubuntu 16.04 and above
sudo apt-get -y update
sudo apt-get install -y build-essential libcurl4-openssl-dev unzip software-properties-common git libpcre3-dev libpcre3

adding zlib, openssl and pcre

cd && mkdir sources && cd sources
wget https://downloads.sourceforge.net/project/pcre/pcre/8.41/pcre-8.41.tar.gz && tar xzvf pcre-8.41.tar.gz
4.0K ./.rvm/wrappers
8.0K ./.rvm/lib/rvm
16K ./.rvm/lib
4.0K ./.rvm/log
12K ./.rvm/scripts/zsh/Completion
16K ./.rvm/scripts/zsh
24K ./.rvm/scripts/extras/java_read_properties
12K ./.rvm/scripts/extras/completion.zsh
16K ./.rvm/scripts/extras/bash_zsh_support/chpwd
32K ./.rvm/scripts/extras/bash_zsh_support
/dev/root 79360 12788 66572 17% /
devtmpfs 956368 186 956182 1% /dev
tmp 956612 19 956593 1% /tmp
run 956612 1161 955451 1% /run
shmfs 956612 1 956611 1% /dev/shm
/dev/sda1 6258720 1532903 4725817 25% /var
/dev/sda8 4096 11 4085 1% /usr/share/oem
media 956612 1 956611 1% /media
tmpfs 956612 13 956599 1% /sys/fs/cgroup
tmpfs 956612 2 956610 1% /mnt/disks
CREATE TABLE `products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`slug` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`text` text COLLATE utf8_unicode_ci,
`price` float DEFAULT NULL,
`vat` float DEFAULT NULL,
`shipping_price` float DEFAULT NULL,
`published` tinyint(1) DEFAULT NULL,
`product_category_id` int(11) DEFAULT NULL,
@benbonnet
benbonnet / node
Created February 19, 2017 12:59
describe node
Name: gke-deemx-frontend-398eefb6-b3jq
Role:
Labels: beta.kubernetes.io/arch=amd64
beta.kubernetes.io/instance-type=n1-standard-2
beta.kubernetes.io/os=linux
cloud.google.com/gke-nodepool=frontend
failure-domain.beta.kubernetes.io/region=europe-west1
failure-domain.beta.kubernetes.io/zone=europe-west1-b
kubernetes.io/hostname=gke-deemx-frontend-398eefb6-b3jq
Taints: <none>
@benbonnet
benbonnet / 1.dropletkit_cmd.rb
Last active December 8, 2016 11:31
CURL vs. Dropletkit
require "droplet_kit"
require "net/http"
userdata = "
#cloud-config
coreos:
etcd2:
discovery: https://discovery.etcd.io/xxx
advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001
@benbonnet
benbonnet / file.txt
Created October 15, 2016 13:50
kubernetes / Allow pull from gcr
Go to the Google Developer Console > Api Manager > Credentials and click "Create credentials" and create a "service account key"
Under "service account" select new and name the new key "gcr" (let the key type be json)
Create the key and store the file on disk (from here on we assume that it was stored under ~/secret.json)
Now login to GCR using Docker from command-line:
$ docker login -e your@email.se -u _json_key -p "$(cat ~/secret.json)" https://eu.gcr.io
This will generate an entry for "https://eu.gcr.io" in your ~/.docker/config.json file.
Copy the JSON structure under "https://eu.gcr.io" into a new file called "~/docker-config.json", remove newlines! For example:
@benbonnet
benbonnet / README.md
Last active December 3, 2017 11:42
create a gcloud compute instance with an init script

if not done already, type :

$ gcloud init

Assuming you already have ssh keys on your local workstation, create a gcloud specific one by appending your_username: to the file. In the end it will have the following format (we'll name the file gcloud_id_rsa.pub) :

your_username : ssh-rsa kfjdlsfjsdjklfghjkghkflkdjetc...

Then send it to gcloud :

root@deemx-temp:~# sudo tail -f /var/log/apt/term.log
Warning: Stopping snapd.service, but it can still be activated by:
snapd.socket
Unpacking snapd (2.14.2~16.04) over (2.13) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for dbus (1.10.6-1ubuntu3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libp11-kit0:amd64 (0.23.2-5~ubuntu16.04.1) ...
Setting up libaccountsservice0:amd64 (0.6.40-2ubuntu11.2) ...
Setting up accountsservice (0.6.40-2ubuntu11.2) ...
require "droplet_kit"
userdata = "
#cloud-config
package_update: true
package_upgrade: true
packages:
- redis-server
"
client = DropletKit::Client.new(access_token: ENV["DO_KEY"])
droplet = DropletKit::Droplet.new(