Skip to content

Instantly share code, notes, and snippets.

View miguelangelgonzalez's full-sized avatar

Miguel Angel Gonzalez miguelangelgonzalez

View GitHub Profile
@jedprentice
jedprentice / export_objects_to_csv.rb
Created April 13, 2022 15:12
Exports Active Record objects to CSV
# Copy to Rails console and call with a class parameter. Assumes
# /var/tmp exists and is writable
require 'csv'
def export_objects(klass)
objects = klass.last(10000)
CSV.open("/var/tmp/#{klass}.csv", 'w') do |row|
row << klass.attribute_names
objects.each do |o|
row << o.attributes.values
@eolant
eolant / Confirm.vue
Last active July 29, 2024 18:14
Vuetify Confirm Dialog component that can be used locally or globally
<template>
<v-dialog v-model="dialog" :max-width="options.width" :style="{ zIndex: options.zIndex }" @keydown.esc="cancel">
<v-card>
<v-toolbar dark :color="options.color" dense flat>
<v-toolbar-title class="white--text">{{ title }}</v-toolbar-title>
</v-toolbar>
<v-card-text v-show="!!message" class="pa-4">{{ message }}</v-card-text>
<v-card-actions class="pt-0">
<v-spacer></v-spacer>
<v-btn color="primary darken-1" text @click.native="agree">Yes</v-btn>
@kekru
kekru / 1-Enable Docker Remote API with TLS client verification.md
Last active June 14, 2024 09:01
Docker Remote API with client verification via daemon.json

Enable Docker Remote API with TLS client verification

Docker's Remote API can be secured via TLS and client certificate verification.
First of all you need a few certificates and keys:

  • CA certificate
  • Server certificate
  • Server key
  • Client certificate
  • Client key

Create certificate files

@ChrisMcKee
ChrisMcKee / PredicatableGuid.cs
Last active April 19, 2024 08:49
Namespaced Deterministic Guid - RFC 4122 dotnetcore
using System;
using System.Security.Cryptography;
using System.Text;
namespace Utility
{
/// <summary>
/// Helper methods for working with <see cref="Guid"/>.
/// </summary>
public static class GuidUtility
@kekru
kekru / Docker connect to remote server.md
Last active September 9, 2024 02:50
Connect to another host with your docker client, without modifying your local Docker installation

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.

@rogeralsing
rogeralsing / gist:d05e4b7cc64a3cfff3b8
Last active March 4, 2018 11:44
Durable Messagebus integration with Akka and Azure Servicebus
using System;
using System.Linq;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Routing;
using Microsoft.ServiceBus.Messaging;
namespace ConsoleApplication13
{
public class MyBusinessActor : ReceiveActor
@phatboyg
phatboyg / Program.cs
Created November 5, 2014 23:41
Sample Topshelf service that demonstrates how features can be toggled using the Fooidity Switchyard
namespace ConsoleApplication2
{
using System;
using System.Threading;
using System.Threading.Tasks;
using Autofac;
using Fooidity;
using Topshelf;
@roshbrahm
roshbrahm / app.html
Created July 9, 2014 10:36
Disable right click i.e. Context Menu and F5 key for refresh in AngularJs
<!DOCTYPE html>
<html ng-app="myapp">
<head>
<title>AngularJs Directive for disabling Context Menu</title>
<style type="text/css">
*.unselectable {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
/*
@scottmcarthur
scottmcarthur / Program.cs
Created April 29, 2014 09:13
Sending complex data to ServiceStack from HTML form synchronously. (ServiceStack v4)
using System;
using ServiceStack;
using ServiceStack.Web;
using ServiceStack.Text;
namespace v4
{
class MainClass
{
public static void Main()
@ScottGuymer
ScottGuymer / index.html
Created March 26, 2014 15:31
Angular $http interceptor to allow for a loading spinner whenever any ajax request is made. Could be extended to provide request logging and error handling.
<div id="loadingWidget" loading-widget>
<div class="loadingContent">
<p>
Loading....Loading....Loading....Loading....Loading....Loading....Loading....Loading....Loading....Loading....Loading....Loading....Loading....Loading....Loading....Loading....Loading....Loading....
</p>
</div>
</div>