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
# A class which collects and inserts bulk of data | |
# Implemented for MySQL 5 | |
# Count of records inserted at once is configured by MAX | |
class BulkImporter | |
MAX = 100 | |
# posts_writer = BulkImporter.new( ActiveRecord::Base.connection, Post ) | |
def initialize(connection, klass) |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
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
upstream php { | |
server unix:/tmp/php-cgi.socket; | |
server 127.0.0.1:9000; | |
} | |
server { | |
listen 80; ## listen for ipv4 | |
# listen [::]:80 default ipv6only=on; ## listen for ipv6 |
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
# put this file into directory <RAILS_ROOT>/lib/tasks | |
namespace :db do | |
desc "Backup database" | |
task :backup do | |
RAILS_ENV = "development" if !defined?(RAILS_ENV) | |
settings = YAML.load(File.read(File.join(Rails.root, "config", "database.yml")))[RAILS_ENV] | |
bak_dir = ENV['BAK_DIR'] | |
raise(RuntimeError, "==> Error: environment variable BAK_DIR not set.") if bak_dir.blank? | |
extra_parameters = ["--default-character-set=utf8"] |
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
/* | |
Simple GTK+ pipe viewer | |
Contributors: Romiras | |
Based on paned.c | |
LICENSE: GNU GPLv3 | |
*/ | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <gtk/gtk.h> |
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
#!/bin/bash | |
# Full system backup with dar. Refer to http://dar.linux.free.fr/doc/Tutorial.html | |
## Configuration | |
# path to store dar backup files | |
Storage=/mnt/disk/backup/Linux | |
# name of system | |
SysName=Ubuntu_`. /etc/os-release; echo ${VERSION_ID/*, /}` |
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
upstream php-handler { | |
server 127.0.0.1:9000; | |
# server unix:/var/run/php5-fpm.sock; | |
} | |
server { | |
listen 80; | |
server_name example.com localhost; | |
root /var/www; |
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
# Project: TestDLL | |
# Makefile created by Dev-C++ 5.5.1 | |
CPP = g++.exe | |
CC = gcc.exe | |
WINDRES = windres.exe | |
OBJ = main.o | |
LINKOBJ = main.o | |
LIBS = -L"C:/Program Files/Development/Dev-Cpp/MinGW32/lib" -L"C:/Program Files/Development/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc | |
INCS = -I"C:/Program Files/Development/Dev-Cpp/MinGW32/include" |
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
require 'active_support/all' # mb_chars | |
def simple_fuzzy_match(s1, s2) | |
levenshtein_distance( normalize_str(s1), normalize_str(s2) ) < 2 | |
end | |
def normalize_str(s) | |
s. | |
mb_chars. # convert to multibyte string (ActiveSupport::Multibyte::Chars) - required in Ruby version below 2.4 | |
downcase. # lower case for all characters |
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 python3 | |
"""Read zip format file from stdin and write new zip to stdout. | |
With the --store option the output will be an uncompressed zip. | |
Uncompressed files are stored more efficiently in VCS. | |
Example: | |
python rezip.py --store < file.docx > file.flat.docx | |
Based on https://github.com/costerwi/rezip |
OlderNewer