Skip to content

Instantly share code, notes, and snippets.

@t0d0r
t0d0r / gista-file
Created May 10, 2017 09:13
catenate.universum.by_letter
+------+------+-------------+
| pp | ss | modified_at |
+------+------+-------------+
| | 0 | 2017-05-09 |
| . | 0 | 2017-04-29 |
| 0 | 9 | 2014-02-13 |
| 1 | 10 | 2016-07-14 |
| 2 | 3 | 2009-01-12 |
| 3 | 2 | 2012-05-15 |
| 5 | 6 | 2011-11-29 |
@t0d0r
t0d0r / index.md
Created May 1, 2017 19:09 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

regions = { :us => 8, :eu => 5 }
terminal = 0
hosts = []
regions.each do |k,v|
1.upto(v).each do |c|
terminal += 1
host = "hv%02d-1-%s-pmx.cloudstrap.io" % [c,k]
hosts << host
halias = host.split('.')[0]
@t0d0r
t0d0r / varnalab-cli-isp.rb
Created October 17, 2016 22:47
varnalab-cli prototype
#!/usr/bin/env ruby
# varnalab-cli isp tcv 00:11:22:33:44:55:66
# varnalab-cli <cmd> <isp_name|release> [mac|ip]
arg_one = %w(tcv mtel release)
puts "ok" if arg_one.include?("tcv")
puts "ok" if arg_one.include?("tcvq")
ip_range = [
p = 3000
cd = (p * ( 10.00/100 ))
dd = ((p-cd)*( 5.00/100 ))
cash = p - cd - dd
puts "=" * 40
puts " %0.2f - %0.2f - %0.2f = %0.2f" % [ p, cd, dd, cash ]
puts "=" * 40
@t0d0r
t0d0r / 24ins.spam
Last active August 16, 2016 12:59
24ins casino spam domains
777-a-bingo.us
777-a-bonus.us
777-a-chance.us
777-a-game.us
777-a-lucky.us
777-a-profit.us
bet-a-bet.us
bet-a-winner.us
bet-and-gain.us
bet-and-slot.us
@t0d0r
t0d0r / wipe14d.sh
Last active August 3, 2016 08:45
wipe all files older that 14 days
#!/bin/bash
DELETE=0
target="/tmp"
# this line only shows what will be deleted
if [ ${DELETE} == "0" ]; then
echo /usr/bin/find ${target} -type f -mtime +14 -printf "%CY%Cm%Cd " -exec ls -al {} \;
else
echo /usr/bin/find ${target} -type f -mtime +14 -printf "%CY%Cm%Cd " -exec rm -v {} \;
fi
@t0d0r
t0d0r / super_farm.rb
Last active February 7, 2016 09:08
dice for super farm board game
#!/usr/bin/env ruby
# encoding: utf-8
# english
dice_red_en = %w(rabbit rabbit rabbit rabbit rabbit rabbit sheep sheep pig pig horse fox)
dice_blue_en = %w(rabbit rabbit rabbit rabbit rabbit rabbit sheep sheep pig pig cow wolf)
# bulgarian
dice_red_bg = %w(заек заек заек заек заек заек овца овца прасе прасе кон лисицa)
dice_blue_bg = %w(заек заек заек заек заек заек овца овца прасе прасе крава вълк)
@t0d0r
t0d0r / default.xsl
Created November 30, 2015 23:57
make Colloquy to support 24h datetime/time format in styles
<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output omit-xml-declaration="yes" indent="no" />
<xsl:param name="consecutiveMessage" />
<xsl:param name="bulkTransform" />
<xsl:param name="timeFormat" />
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$consecutiveMessage = 'yes'">
@t0d0r
t0d0r / redis.mklinks
Last active November 24, 2015 14:17
ruby script