Skip to content

Instantly share code, notes, and snippets.

View lastguest's full-sized avatar
❄️
I may be slow to respond.

Stefano Azzolini lastguest

❄️
I may be slow to respond.
View GitHub Profile
@lastguest
lastguest / .gitlab-ci.yml
Created February 4, 2019 23:46 — forked from foklepoint/.gitlab-ci.yml
Build and Push images to GCP Container Registry with Gitlab CI
image: docker:latest
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
variables:
DOCKER_DRIVER: overlay
GCP_PROJECT_ID: CHANGE-TO-GCP-PROJECT-ID
IMAGE_NAME: image_id
services:
@lastguest
lastguest / serve.sh
Created December 21, 2017 15:29 — forked from LeonB/serve.sh
One-line bash http server
:;while [ $? -eq 0 ];do nc -vlp 8080 -c'(r=read;e=echo;$r a b c;z=$r;while [ ${#z} -gt 2 ];do $r z;done;f=`$e $b|sed 's/[^a-z0-9_.-]//gi'`;h="HTTP/1.0";o="$h 200 OK\r\n";c="Content";if [ -z $f ];then($e $o;ls|(while $r n;do if [ -f "$n" ]; then $e "<a href=\"/$n\">`ls -gh $n`</a><br>";fi;done););elif [ -f $f ];then $e "$o$c-Type: `file -ib $f`\n$c-Length: `stat -c%s $f`";$e;cat $f;else $e -e "$h 404 Not Found\n\n404\n";fi)';done
@lastguest
lastguest / db-open
Created October 10, 2017 09:48 — forked from helderco/db-open
Script to open a mysql database in Sequel Pro from a service in docker-compose.
#!/bin/bash
set -e
show_help() {
cat << EOF
Usage: ${0##*/} [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE]
${0##*/} -h
Open a standard connection in Sequel PRO.
@lastguest
lastguest / pre-receive
Last active August 29, 2015 14:20 — forked from proofek/pre-receive
#!/usr/bin/php
<?php
echo "\nRunning php linter...\n";
$params = explode(' ', file_get_contents('php://stdin'));
$ref = trim($params[1]);
$diff = array();
$return = 0;
#!/bin/bash
HOSTSFILE="/etc/hosts"
BAKFILE="$HOSTSFILE.bak"
DOMAINREGEX="^[a-zA-Z0-9]{1}[a-zA-Z0-9\.\-]+$"
IPREGEX="^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
URLREGEX="^https?:\/\/[a-zA-Z0-9]{1}[a-zA-Z0-9\/\.\-]+$"
backup()
{
@lastguest
lastguest / cors-nginx.conf
Last active September 6, 2017 09:35 — forked from michiel/cors-nginx.conf
[Wide-open CORS config for nginx] #nginx #server
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
<!doctype html>
<html>
<head>
<!-- Run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make the status bar black with white text. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
/ HTML5 Doctype. Remember to delete these comments (Quirks Mode).
!!!
/ Modernizr HTML tag.
%html.no-js{lang: ""}
/ Let's get started.
%head
/ Document settings and metadata.
#!/bin/sh
#current info
CUR_URL=development.server.com
CUR_DB_HOST=database_host
CUR_DB_NAME=database_name
CUR_DB_USER=database_user
CUR_DB_PASS=database_password
CUR_PATH=/path/to/site/