Skip to content

Instantly share code, notes, and snippets.

@afro-coder
afro-coder / main.go
Last active March 16, 2023 09:23
Golang script to write/update to Google Sheets
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"database/sql"
@alexellis
alexellis / README.md
Last active February 8, 2021 20:50
Provision faasd 0.7.5 on DigitalOcean with Terraform 0.12.0
  1. Sign up to DigitalOcean
  2. Download Terraform
  3. Clone this gist using the URL from the address bar
  4. Run terraform init
  5. Run terraform apply -var="do_token=$(cat $HOME/digitalocean-access-token)"
  6. View the output for the login command and gateway URL i.e.
gateway_url = http://178.128.39.201:8080/
login_cmd = faas-cli login -g http://178.128.39.201:8080/ -p rvIU49CEcFcHmqxj
@shaneutt
shaneutt / LICENSE
Last active April 30, 2024 02:00
Golang: Demonstrate creating a CA Certificate, and Creating and Signing Certs with the CA
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@jthomas
jthomas / README.md
Last active February 20, 2023 20:52
OpenWhisk Workshop

OpenWhisk Workshop

Hello 👋.

This workshop will teach you how to develop serverless applications, composed of loosely coupled microservice-like functions, using an open-source serverless platform.

Starting with getting the development environment set up, it'll move onto creating, deploying and invoking serverless functions for multiple runtimes. Once you are comfortable creating serverless functions, the next step is to connect functions to events, like message queues, allowing microservices to fire automatically. Finally, we'll demonstrate how to expose serverless functions as public API endpoints, allowing to build serverless web applications.

Welcome to the future of cloud development, you'll never want to manage another server again 😎.

class ErrorHandler {
public signal void publish (Error err);
private static ErrorHandler _default;
public static ErrorHandler get_default () {
if (_default == null) {
_default = new ErrorHandler ();
}
return _default;
}
}
@iam1980
iam1980 / windows10_bashrc
Created June 10, 2017 09:33
.bashrc windows 10
LS_COLORS='rs=0:di=1;35:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*
@iben12
iben12 / 1_Laravel_state-machine.md
Last active August 12, 2023 08:36
Laravel: State-machine on Eloquent Model

Implementing State Machine On Eloquent Model*

* Update (12.09.2017): I have improved the trait so that it can be used with objects other than Eloquent Models.

Some days ago I came across a task where I needed to implement managable state for an Eloquent model. This is a common task, actually there is a mathematical model called "Finite-state Machine". The concept is that the state machine (SM) "can be in exactly one of the finite number of states at any given time". Also changing from one state to another (called transition) depends on fulfilling the conditions defined by its configuration.

Practically this means you define each state that the SM can be in and the possible transitions. To define a transition you set the states on which the transition can be applied (initial conditions) and the only state in which the SM should be after the transition.

That's the theory, let's get to the work.

<?php
class Csv
{
public static function fromArray($rows, $delimiter = ',')
{
if (empty($rows)) {
return '';
}
@arteymix
arteymix / example.vala
Last active July 2, 2017 06:08
Example of non-blocking execution in GTK with Vala (run with `vala --pkg=gtk+-3 example.vala`)
using Gtk;
Button button;
public static int main (string[] args) {
Gtk.init (ref args);
var window = new Window ();
window.title = "Count without blocking the UI";
window.border_width = 10;
window.window_position = WindowPosition.CENTER;
@ivanoats
ivanoats / jqh.js
Created December 10, 2015 04:32
Hyperscript for jQuery
// hyperscript for jQuery
// create nested HTML elements with a DSL
// used to create reusable, interactive HTML components
//
// based on the many implentations out there like
// https://github.com/dominictarr/hyperscript
// https://github.com/Matt-Esch/virtual-dom/tree/master/virtual-hyperscript
// and Elm https://github.com/evancz/elm-html
var $h = function(element, properties, content) {
var $component = $('<' + element + '>');