This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Network.HTTP.Conduit | |
import qualified Data.ByteString.Lazy as L | |
import Text.XML.Light | |
import Control.Monad.Trans (liftIO) | |
import Control.Monad | |
import Data.String.Utils | |
import Control.Exception | |
import Control.Monad.Trans.Resource | |
import Control.Monad.Trans.Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>notif</title> | |
</head> | |
<body id="notif" onload=""> | |
<input id="new-notif" type="button" value="Show notification"/> | |
<script type="text/javascript"> | |
'use strict'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 require "rubygems" | |
2 require 'adhearsion' | |
3 require 'adhearsion/voip/asterisk/manager_interface' | |
4 class DropsController < ApplicationController | |
5 include Adhearsion::VoIP::Asterisk::Manager | |
6 include Adhearsion::VoIP::Asterisk::Commands | |
7 AMI_SERVER = "localhost" | |
8 AMI_USER_NAME = "admin" | |
9 AMI_PASSWORD = "amp111" | |
10 def show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding utf-8 | |
ROWS = 2 | |
words = [] | |
maxlength = 0 | |
File.open("words.txt", "r") do |f| | |
f.each_line do |l| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/daemon.rb | |
class Daemon < DaemonSpawn::Base | |
def start args | |
while true | |
# ... функциональная часть | |
sleep 3600 | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :daemon do | |
task :restart do | |
run <<-CMD | |
cd #{latest_release}; | |
RAILS_ENV=production script/cron stop; | |
RAILS_ENV=production script/cron start; | |
CMD | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require File.dirname(__FILE__) + '/../config/boot' | |
require "#{RAILS_ROOT}/config/environment" | |
File.open "log/daemon.log", "w" if !File.exists? "log/daemon.log" | |
Daemon.spawn! :log_file => "#{RAILS_ROOT}/log/daemon.log", | |
:pid_file => "#{RAILS_ROOT}/tmp/pids/daemon.pid", | |
:sync_log => true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File.open("/etc/passwd").each_line do |line| | |
arr = line.split(":") | |
puts "#{arr.first} - #{arr.last}" | |
end | |
File.open("/etc/passwd") do |io| | |
io.each_line do |line| | |
arr = line.split(":") | |
puts "#{arr.first} - #{arr.last}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo <<<EOS | |
<?xml version="1.0" encoding="UTF-8" ?> | |
<Module> | |
<ModulePrefs title="My sponsors" /> | |
<Content type="html"> | |
<![CDATA[ | |
<div style="background-color: #710;"> | |
EOS; | |
if (!defined('_SAPE_USER')){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# :%s/%appname%/_appname_/g | |
# :%s/%appname%/_username_/g | |
# :%s/%domain%/_domain_/g | |
set :application, "%appname%" | |
set :repository, "git@github.com:smix/%appname%.git" | |
set :deploy_to, "/var/rails/%appname%" | |
set :deploy_via, :remote_cache | |
set :branch, 'master' | |
set :scm, :git |
OlderNewer