As configured in my dotfiles.
start new:
tmux
start new with session name:
| import pyes | |
| conn = pyes.es.ES("localhost:9200") | |
| all = conn.search(pyes.query.MatchAllQuery(), 'index', 'type', scan=True) | |
| for a in all: | |
| conn.index(a, 'index', 'type', a.get_id(), bulk=True) |
| /*----------------------------------------------------*/ | |
| #pragma mark - XCTAsserts | |
| /*----------------------------------------------------*/ | |
| XCTAssert(expression, format...); | |
| XCTAssertTrue(expression, format...); | |
| XCTAssertFalse(expression, format...); | |
| XCTAssertEqual(expression1, expression2, format...); | |
| XCTAssertNotEqual(expression1, expression2, format...); | |
| XCTAssertNil(expression, format...); |
| import Foundation | |
| import UIKit | |
| class PassThroughView: UIView { | |
| override func pointInside(point: CGPoint, withEvent event: UIEvent?) -> Bool { | |
| for subview in subviews as [UIView] { | |
| if !subview.hidden && subview.alpha > 0 && subview.userInteractionEnabled && subview.pointInside(convertPoint(point, toView: subview), withEvent: event) { | |
| return true | |
| } | |
| } |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| package main | |
| import ( | |
| "crypto/tls" | |
| "crypto/x509" | |
| "flag" | |
| "io/ioutil" | |
| "log" | |
| "net/http" | |
| ) |
| #!/bin/sh | |
| hostname=$1 | |
| # Change the hostname | |
| sudo hostnamectl --transient set-hostname $hostname | |
| sudo hostnamectl --static set-hostname $hostname | |
| sudo hostnamectl --pretty set-hostname $hostname | |
| sudo sed -i s/raspberrypi/$hostname/g /etc/hosts |
| #!/bin/sh | |
| ip=$1 | |
| dns=$2 | |
| sudo cat <<EOT >> /etc/dhcpcd.conf | |
| interface eth0 | |
| static ip_address=$ip/24 | |
| static routers=$dns |
| sudo apt update | |
| sudo apt install -y docker.io docker-compose libffi-dev libssl-dev python python-pip | |
| sudo apt remove -y python-configparser | |
| sudo apt autoremove -y | |
| # permission for docker (Raspberry Pi with Ubuntu(eoan)) | |
| sudo usermod -aG docker ubuntu | |
| sudo chown ubuntu:docker /var/run/docker.sock |
| # Setup daemon. | |
| cat > /etc/docker/daemon.json <<EOF | |
| { | |
| "exec-opts": ["native.cgroupdriver=systemd"], | |
| "log-driver": "json-file", | |
| "log-opts": { | |
| "max-size": "100m" | |
| }, | |
| "storage-driver": "overlay2" | |
| } |
| # this solution is only for ubuntu 19 on Raspberry Pi | |
| append | |
| cgroup_enable=memory cgroup_memory=1 | |
| to /boot/firmware/nobtcmd.txt | |
| # Reboot | |
| # then cat /proc/cmdline and cat /proc/cgroups to verify | |
| # https://askubuntu.com/questions/1189480/raspberry-pi-4-ubuntu-19-10-cannot-enable-cgroup-memory-at-boostrap/1189542#1189542 |