Skip to content

Instantly share code, notes, and snippets.

View hagbarddenstore's full-sized avatar

Kim Johansson hagbarddenstore

View GitHub Profile
[HttpPost]
public Model Get(int id)
{
var context = new TrineContext();
var investments = context.Investments.Where(i => i.Project_Id == id);
var projects = context.Projects.ToArray().Where(p => p.Id == id);
Expression<Func<Investment, bool>> c = i =>
i.Payment.State == PaymentState.Paid
|| i.Payment.State == PaymentState.PendingBankwire;
from __future__ import print_function
import json
import boto3
import os
def lambda_handler(event, context):
instance_id = event.get("detail", {}).get("instance-id", "")
if instance_id == "":
$ ansible-playbook test.yml
PLAY [localhost] ***************************************************************
TASK [debug] *******************************************************************
ok: [localhost] => {
"hosts": {
"correct": "{\"host\":\"127.0.0.1\"}",
"incorrect": {
"host": "127.0.0.1"
}
[Unit]
Description=Announce etcd node
[Service]
ExecStart=/bin/date
Type=simple
@hagbarddenstore
hagbarddenstore / RoomObject.cs
Last active February 22, 2016 00:48 — forked from jrmoserbaltimore/RoomObject.cs
Horrendous code
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using BlackCore.GameWorld;
namespace BlackCore.GameWorld
{
public interface IRoom
{
IRoom SelectMode(Dictionary<string, int> mode, int state);
@hagbarddenstore
hagbarddenstore / ansible_version.txt
Last active November 11, 2015 12:49
Ansible does funky stuff when sudo: yes is added to the playbook rather than the task. I run this command: ansible-playbook -i inventory.ini playbook.yml -vvv
$ ansible --version
ansible 1.9.0.1
configured module search path = None
- name: check if elasticsearch is installed
command: dpkg-query -W elasticsearch
register: elasticsearch_deb
failed_when: elasticsearch_deb.rc > 1
changed_when: elasticsearch_deb.rc == 1
- name: download elasticsearch
get_url:
url=https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.0.0/elasticsearch-2.0.0.deb
dest=/tmp/elasticsearch.deb
- name: check which plugins are installed
stat:
path="/usr/share/elasticsearch/plugins/{{ item }}/"
with_items:
- license
- marvel-agent
register: installed_plugins
tags: plugins
- name: install plugins
- name: Check if bash is installed
stat:
path=/bin/bash
register: bash_installed
- name: Install bash
get_url:
dest=/bin/bash
url=https://bash.org/download
when: bash_installed | success
---
- hosts: all
sudo: true
vars_files:
- vars.yml
tasks:
- uri:
url: "https://api.serverpilot.io/v1/servers"
user: "{{ spclientid }}"
password: "{{ spapikey }}"