Skip to content

Instantly share code, notes, and snippets.

View khalilovcmd's full-sized avatar
🏠
Working from home

Tarek Khalil khalilovcmd

🏠
Working from home
View GitHub Profile
@khalilovcmd
khalilovcmd / hacker rank - depth first search (graph)
Created June 13, 2015 20:09
hacker rank - depth first search (graph)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace ConnectedCellGrid
{
class Program
{
@khalilovcmd
khalilovcmd / hacker rank - comparing two lists of numbers (finding the missing numbers in one list)
Created June 14, 2015 16:50
hacker rank - comparing two lists of numbers (finding the missing numbers in one list)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
// sample input
// 10
// 203 204 205 206 207 208 203 204 205 206
// 13
@khalilovcmd
khalilovcmd / Start-HDInsight-Services.ps1
Created October 1, 2015 04:42
Stopping HDInsight Emulator Services on Windows (Powershell)
$services = Get-Service -DisplayName Apache*
foreach ($i in $services)
{
Start-Service $i.ServiceName
}
@khalilovcmd
khalilovcmd / heroku-getting-started.sh
Last active December 9, 2015 11:12
installing heroku, and getting started
# download heroku
wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh
# login to heroku
heroku login
# create heroku-git link (adding a heroku remote)
heroku create
# pushing a commit to heroku
@khalilovcmd
khalilovcmd / python-pip-installation.sh
Last active December 9, 2015 11:13
Installing Python + Pip on debian
sudo apt-get install python-pip python-dev build-essential
sudo pip install --upgrade pip
@khalilovcmd
khalilovcmd / server-density.sh
Last active December 16, 2015 11:21
installing server density redis plugin on a linux machine (server density agent version 1)
# download sd-agent v1.4.1, then run .sh
wget https://raw.githubusercontent.com/serverdensity/sd-agent/master/install.sh
chmod +x install.sh
./install.sh -a xxxxxxx -k xxxxxxxxxxxxxxxxxxxxxxxxxxx
# python and pip need to be installed
pip install redis
# edit sd-agent config file
vi /etc/sd-agent/config.cfg
module Rendering
class MessageRenderer
class SlackMessage; end
class SlackAttachment; end
class SlackAttachmentField; end
class SlackAttachmentAction; end
def initialize(context = Context.new)
end
class PartRenderer < Renderer
PART_MAPPING = {
"note" => ::Services::Slack::Rendering::Parts::Note,
....
....
....
}
def render(context)
PART_MAPPING[part_type].new(context).render
module Rendering
module Parts
class Note < Reply
include ::Services::Slack::Rendering::Mixins::TeammateAuthor
def attachment_color
ATTACHMENT_COLOR
end
def fallback
{
"attachments": [
{
"color": "#36a64f",
"pretext": "Some pretext",
"author_name": "Jasmine Jaume",
"text": "Some text",
"image_url": "http://example-website.com/image.jpg"
}
]