Skip to content

Instantly share code, notes, and snippets.

@atomicpages
atomicpages / class.log.php
Created October 15, 2014 20:31
A really simple logging class
<?php
/**
* Class Log
* A really simple logging class that writes flat data to a file.
* @author Dennis Thompson
* @license MIT
* @version 1.0
* @copyright AtomicPages LLC 2014
*/
@DevInTheTrenches
DevInTheTrenches / kubia.yaml
Created March 16, 2019 17:31
Simple Hands-on Introduction to K3S - Lightweight Kubernetes
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: whoareyou-deployment
namespace: default
spec:
replicas: 2
selector:
matchLabels:
app: whoareyou
@maxkostinevich
maxkostinevich / worker.js
Created June 29, 2020 11:25
Serverless Geolocation Service
/*
* Serverless Geolocation Service, hosted on Cloudflare Workers.
*
* Learn more at https://maxkostinevich.com/blog/serverless-geolocation
*
* (c) Max Kostinevich / https://maxkostinevich.com
*/
// https://gist.github.com/maephisto/9228207
@gokhansengun
gokhansengun / Vagrantfile
Created February 21, 2018 19:10
Vagrantfile used in Istanbul Coders - Kubernetes Introduction Meetup
# -*- mode: ruby -*-
# vi: set ft=ruby :
K8S_DEV_BOX_NAME = "gsengun/k8s-dev-box"
K8S_DEV_BOX_VERSION = "17.12.27"
MASTER_NODE_IP_START="172.27.44.20"
WORKER_NODE_IP_START="172.27.44.10"
JOIN_TOKEN="abcdef.1234567890123456"
@developer-guy
developer-guy / test.sh
Last active February 1, 2021 10:28
Display Kubernetes OpenAPI Spec
#!/usr/bin/env bash
set -e
# Proxy minikube to localhost on arbitrary port:
kubectl proxy --port=8080 &
sleep 3
# Now swagger.json is available at localhost:12345/openapi/v2
# Save to /tmp/temp/json and serve with e.g. docker swagger-ui container
curl http://localhost:8080/openapi/v2 > /tmp/temp.json
docker container run -d -p 9999:8080 -e SWAGGER_JSON=/var/specs/temp.json -v /tmp/temp.json:/var/specs/temp.json swaggerapi/swagger-ui
package main
import (
"context"
"flag"
image2 "github.com/aquasecurity/fanal/artifact/image"
"github.com/aquasecurity/fanal/cache"
"github.com/aquasecurity/fanal/image"
dbTypes "github.com/aquasecurity/trivy-db/pkg/types"
"github.com/aquasecurity/trivy/pkg/log"
<?php
use Illuminate\Database\Query\Builder;
Builder::macro('orderByNulls', function ($column, $direction = 'asc', $nulls = 'last', $bindings = []) {
$column = $this->getGrammar()->wrap($column);
$direction = strtolower($direction) === 'asc' ? 'asc' : 'desc';
$nulls = strtolower($nulls) === 'first' ? 'NULLS FIRST' : 'NULLS LAST';
return $this->orderByRaw("$column $direction $nulls", $bindings);
});
@c1982
c1982 / aws-region-names.go
Last active May 11, 2021 10:41
AWS region names with bill region names
type AwsRegion struct {
Region string
Location string
Code string
A1 string
Latitude string
Longitude string
}
@linuxgemini
linuxgemini / megalovania.rsc
Created February 11, 2019 18:03
RouterOS script to play megalovania
# megalovania first part
# for mikrotik routerboard
# by linuxgemini
#
# challenge started by ave
# bar 1
/beep frequency=293 length=0.14
/delay delay-time=0.14
/beep frequency=293 length=0.122
#!/bin/bash
if [[ $DEBUG == "true" ]]; then
set -x
fi
# Check if FQDN is given
if [ -z "$1" ]; then
echo "Usage: $0 rancher.yourdomain.com"
exit 1
fi