Skip to content

Instantly share code, notes, and snippets.

Avatar

Jorge Gueorguiev Garcia MiyamotoAkira

View GitHub Profile
@MiyamotoAkira
MiyamotoAkira / TestFactorySubstitute.cs
Last active Aug 29, 2015
Use of lambda delegate as factory.
View TestFactorySubstitute.cs
using System;
namespace TestFactorySubstitute
{
public class MyClass
{
public int Execute (Func<string, MyDependency> mydependency, int value)
{
return mydependency(DateTime.Now.ToShortTimeString()).Call(value);
@MiyamotoAkira
MiyamotoAkira / appointment-core.clj
Created Aug 9, 2016
Simple Liberator application
View appointment-core.clj
(ns libtest2.core
(:require [liberator.core :refer [defresource]]
[liberator.dev :refer [wrap-trace]]
[compojure.core :refer [defroutes ANY]]
[clojure.data.json :as json]
[clojure.java.io :as io]))
(defonce appointments (ref []))
(defresource handle-appointments []
View Line_Algebra.py
class Line:
def __init__(self, x1, y1, x2, y2):
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
def find_x(self, y):
return ((self.x2*(y-self.y1)) - (self.x1*y)+(self.x1*self.y2))/(self.y2-self.y1)
View gist:1d95ff1330aff87acfc8f2d3bf6f5b1d
Given a client makes a deposit of 1000 on 10-01-2012
And a deposit of 2000 on 13-01-2012
And a withdrawal of 500 on 14-01-2012
When she prints her bank statement
Then she would see
date || credit || debit || balance
14/01/2012 || || 500.00 || 2500.00
13/01/2012 || 2000.00 || || 3000.00
10/01/2012 || 1000.00 || || 1000.00
@MiyamotoAkira
MiyamotoAkira / init.el
Last active Jun 27, 2018
Emacs Basics Workshop
View init.el
(setq custom-file "~/.emacs.d/custom.el")
(require 'package)
(setq package-archives
(quote
(("elpa" . "https://elpa.gnu.org/packages/")
("melpa-stable" . "https://stable.melpa.org/packages/")
("melpa" . "https://melpa.org/packages/"))))
@MiyamotoAkira
MiyamotoAkira / setup-instructions.md
Last active Feb 28, 2018
Setup instructions for the Emacs Workshop
View setup-instructions.md

Hello everyone,

to get your system ready there are two ways to proceed. One using a Virtualbox setup, the other installing all needed on your personal machines.

VirtualBox version

You need to install VirtualBox. Go to https://www.virtualbox.org/ and Download and install the application (for linux users, you can check if your distro has official packages). After you have done that you will want to download and unzip the file https://s3.eu-west-2.amazonaws.com/emacs-workshop/emacs-vdi.zip (2.6 Gb compressed, 6.2 expanded) and the virtualbox file https://s3.eu-west-2.amazonaws.com/emacs-workshop/Emacs-Basic.vbox (both on the same folder). You can then proceed to add it into Virtualbox (On the Menu Machine->Add).

After that, make sure that you can log into the machine (username and password are emacs). You should see the Emacs icon on the left hand launcher.

Your machine

@MiyamotoAkira
MiyamotoAkira / doors.rb
Created Jan 1, 2020
No point on changing the door
View doors.rb
prng = Random.new
on_3 = 0
on_2 = 0
on_1 = 0
total = 100000
partial = 0
total_changes = 0
correct_after_change = 0
wrong_after_change = 0
@MiyamotoAkira
MiyamotoAkira / client.clj
Last active Nov 3, 2021
Adding support for having role_arn and source_profile to cognitect aws
View client.clj
(ns aws.client
(:require [cognitect.aws.client.api :as aws]
[cognitect.aws.util :as u]
[clojure.java.io :as io]
[clojure.tools.logging :as log]
[cognitect.aws.config :as config]
[cognitect.aws.credentials :as credentials])
(:import (java.io File)))
(defn assumed-role-credentials-provider [parent-profile role-arn]