Skip to content

Instantly share code, notes, and snippets.

@Ptico
Ptico / ramfs
Last active August 29, 2015 14:07 — forked from raggi/ramfs
#!/bin/bash
ramfs_size_mb=1024
mount_point=~/volatile
ramfs_size_sectors=$((${ramfs_size_mb}*1024*1024/512))
ramdisk_dev=`hdid -nomount ram://${ramfs_size_sectors}`
newfs_hfs -v 'Volatile' ${ramdisk_dev}
mkdir -p ${mount_point}
mount -o noatime -t hfs ${ramdisk_dev} ${mount_point}
echo "remove with:"
require 'benchmark'
require 'tsort'
def TSort.tsort_each_enum(each_node, each_child) # :yields: node
return to_enum(__method__, each_node, each_child) unless block_given?
TSort.each_strongly_connected_component(each_node, each_child) {|component|
if component.size == 1
yield component.first
else
@Ptico
Ptico / bench.txt
Last active August 29, 2015 14:10
Before:
user system total real
camelize 1.090000 0.120000 1.210000 ( 1.209177)
underscore 1.280000 0.130000 1.410000 ( 1.421322)
dasherize 0.540000 0.070000 0.610000 ( 0.605857)
demodulize 0.370000 0.050000 0.420000 ( 0.420292)
foreign_key 1.020000 0.080000 1.100000 ( 1.103289)
ordinalize 3.570000 0.230000 3.800000 ( 3.809217)
pluralize 5.000000 0.110000 5.110000 ( 5.113936)
.demo {
position: static;
display: block;
float: left;
clear: both;
box-sizing: border-box;
left: 0;
class A
attr_accessor :foo
def initialize
@mutex = Mutex.new
end
def perform
t1 = Thread.new do
@foo ||= 10
@Ptico
Ptico / 1_instructions.md
Created June 18, 2015 18:13
Список журналажи и тотальной зрады (пополняется)

Следуя данной инструкции вы избавитесь от паники, тотальной зрады, а так же улучшите настроение и аппетит.

Если у вас windows 8 и выше

  1. Читаете как править файл hosts здесь: http://skesov.ru/kak-izmenit-fayl-hosts-na-windows-8-1-ili-8/
  2. Вставляете в конец файла записи из списка ниже
  3. Сохраняете

Если у вас MacOS X или Linux

@Ptico
Ptico / SassMeister-input.scss
Last active August 29, 2015 14:25
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
.pretty-form {
input {
&[type="text"], &[type="password"], &[type="email"], &[type="url"], &[type="month"], &[type="number"], &[type="search"], &[type="tel"], &[type="week"] {
&:invalid, .invalid & {
color: red;
}
@Ptico
Ptico / site.conf
Created October 1, 2015 12:49 — forked from paskal/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@Ptico
Ptico / gems.rb
Created October 6, 2015 14:42
My default rails gemfile
source 'https://rubygems.org'
BUNDLE_RAILS_VERSION = '~> 4.2.4'
# Rails
gem 'railties', BUNDLE_RAILS_VERSION
gem 'activesupport', BUNDLE_RAILS_VERSION
gem 'actionpack', BUNDLE_RAILS_VERSION
gem 'actionmailer', BUNDLE_RAILS_VERSION
gem 'activejob', BUNDLE_RAILS_VERSION

Keybase proof

I hereby claim:

  • I am ptico on github.
  • I am ptico (https://keybase.io/ptico) on keybase.
  • I have a public key ASD84JPGkyH33x0DJUEohQ0xz_lTuCLfGUu9cIAdS9XoIgo

To claim this, I am signing this object: