Skip to content

Instantly share code, notes, and snippets.

View hyperized's full-sized avatar
🥑
Eating a sandwich

hyperized

🥑
Eating a sandwich
View GitHub Profile
@hyperized
hyperized / temperature.sh
Created November 25, 2020 11:55
Script to display temperature in the console
#!/usr/bin/env bash
# Run like: ./temperature.sh &
# Requires sensors and smartctl
while true; do
tput sc
tput cup 0 $(($(tput cols)-74))
cpu=$(sensors | grep temp1 | awk '{print $2}')
<?php declare(strict_types=1);
namespace Hyperized\File\Safe;
use Hyperized\File\Exceptions\CouldNotGetGroupId;
/**
* @param string $filename
* @return int
* @throws CouldNotGetGroupId
---
stages:
- testing
- qa
phpstan:
image:
name: hyperized/phpstan:latest
entrypoint: [""]
stage: testing
@hyperized
hyperized / .gitlab-ci.yml
Last active December 24, 2019 10:18
Example of Laravel deployment over SSH via Gitlab CI
---
stages:
- pull
- npm
- push
- permissions
- composer
- migrations
- optimize
# Loosely based on: https://github.com/linuxkit/linuxkit/blob/master/pkg/runc/Dockerfile
FROM linuxkit/alpine:86cd4f51b49fb9a078b50201d892a3c7973d48ec as alpine
ENV GOPATH=/go
ENV PATH=$PATH:/go/bin
ENV runc_version "v1.0.0-rc9"
RUN \
apk add \
bash \
FROM linuxkit/alpine:6906a00130f0b0209db8cc50803b7423e0c3f245 as alpine
RUN apk add -U tzdata
RUN mkdir -p /etc/init.d
RUN ln -s /usr/bin/service /etc/init.d/020-containerd
FROM golang:1.13-alpine as builder
ENV containerd_version "v1.3.2"
ENV GOPATH=/go
<?php
public static function isUpperBoundary(array $input, int $current_key, $pattern, int $steps_back): bool
{
for ($counter = $current_key - 1; $counter >= $current_key - $steps_back; $counter--) {
if (!array_key_exists($counter, $input) || $input[$counter] !== $pattern) {
return false;
}
}
return true;
@hyperized
hyperized / basic.yml
Created October 16, 2019 09:02
Basic steps
- name: disable automatic list updates
lineinfile:
path: /etc/apt/apt.conf.d/20auto-upgrades
regexp: '^APT::Periodic::Update-Package-Lists*'
line: 'APT::Periodic::Update-Package-Lists "0";'
- name: disable automatic updates
lineinfile:
path: /etc/apt/apt.conf.d/20auto-upgrades
regexp: '^APT::Periodic::Unattended-Upgrade*'
FROM php:7.2-fpm-alpine
LABEL maintainer="Gerben Geijteman <[email protected]>"
LABEL description="My Laravel base image with Redis support"
RUN apk --update add --virtual build-dependencies autoconf build-base \
&& docker-php-ext-install bcmath \
&& docker-php-ext-install pdo_mysql \
&& pecl install redis-4.3.0 \
&& docker-php-ext-enable redis \
server {
listen 80;
server_name _;
root /site/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;