$ mkdir sopcast
$ cd sopcast
$ wget http://download.sopcast.com/download/sp-auth.tgz
$ tar xzvf sp-auth.tgz
$ sudo cp sp-sc-auth /usr/local/bin/
$ cd ..
$ wget http://www.sopcast.com/download/libstdcpp5.tgz
This file contains hidden or 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
require 'twitter' | |
require 'unicode_utils' | |
client = Twitter::Streaming::Client.new do |config| | |
config.consumer_key = "YOUR_CONSUMER_KEY" | |
config.consumer_secret = "YOUR_CONSUMER_SECRET" | |
config.access_token = "YOUR_ACCESS_TOKEN" | |
config.access_token_secret = "YOUR_ACCESS_SECRET" | |
end |
This file contains hidden or 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
# app/models/experience.rb | |
# | |
# == Schema Information | |
# | |
# Table name: experiences | |
# | |
# id :integer not null, primary key | |
# title :string | |
# description :text | |
# created_at :datetime not null |
This file contains hidden or 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
# app/mailers/action_notifier.rb | |
public | |
def generate_csn_notifications_and_deliver(users, template) | |
if @email_notification # maybe instead for @csn_email and @csn_online we pass an argument instead | |
users.each do |user| | |
m = mail(:to => user.email) do |format| | |
format.html { render :text => template } | |
end |
This file contains hidden or 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 | |
# Build a Hash tree from Array Of file names | |
# | |
def build_hash_tree(filenames) | |
files_tree = filenames.inject({}) { |h, i| t = h; i.split("/").each { |n| t[n] ||= {}; t = t[n] }; h } | |
end | |
# Box-drawing character - https://en.wikipedia.org/wiki/Box-drawing_character | |
# ├ └ ─ │ |
This file contains hidden or 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/local/bin/ruby -w | |
translated_files = Hash.new{ |h, k| h[k] = [] } | |
common_dir = "/en" | |
langs = ['ru', 'uk'] | |
dest_files = ['/en/share/messages/common.properties', '/en/strings/enterprise/service.properties'] | |
langs.each do |lang| | |
dest_files.each do |file| | |
translated_files[lang] << { dest: file } |
This file contains hidden or 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 | |
require 'pp' | |
require 'open-uri' | |
require 'mechanize' | |
require 'lastfm' | |
require 'vkontakte' | |
### Last.fm credentials | |
# |
This file contains hidden or 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 | |
# Скрипт для скачування оновлень для програми OPZ (Податкова звітність) | |
require 'net/ftp' | |
require 'logger' | |
local_path = '/home/ftp/opz' | |
log_file = File.open(local_path + '/' + 'opz.log', File::WRONLY | File::APPEND | File::CREAT) |
This file contains hidden or 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 | |
require 'dbf' | |
require 'ruby-progressbar' | |
require 'sqlite3' | |
require 'getoptlong' | |
module DBF | |
module Column | |
class Base |
This file contains hidden or 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
$ cat ternary.c | |
#include <stdio.h> | |
int main() { | |
printf("%s\n", 0 ? "a" : 0 ? "b" : "c"); | |
printf("%s\n", 0 ? "a" : 1 ? "b" : "c"); | |
printf("%s\n", 1 ? "a" : 0 ? "b" : "c"); | |
printf("%s\n", 1 ? "a" : 1 ? "b" : "c"); | |
} |