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
# Install docker | |
# This sets a percona-5.6 container to run continuously | |
# set ROOT_MYSQL_PASSWORD | |
export ROOT_MYSQL_PASSWORD="blah" #CHANGEME | |
sudo docker pull percona:5.6 | |
# This folder houses the server data | |
sudo mkdir /data/ |
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
def mapper(a) | |
b = a.map! { |x| x.nil? } | |
end | |
c = [nil] | |
expect(mapper(c)).to eq([true]) # => true | |
expect(mapper(c)).to eq([true]) # => false |
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
# EditorConfig is awesome: http://EditorConfig.org | |
# top-most EditorConfig file | |
root = true | |
# Unix-style newlines with a newline ending every file | |
[*] | |
indent_style = space | |
tab_width = 2 | |
charset = utf-8 |
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 | |
# | |
# This hook changes database name prefix in config/database.yml based on the branch | |
# being checked out. It expects the database name prefix to be on word followed | |
# by a dash. | |
# If the branch name has a dash, it will take the new database name prefix as the | |
# name of the branch before the first dash e.g. ihas-feature => ihas | |
# This allows multiple branches to use the same database. | |
# | |
# File checkouts are ignored. Checking out a remote branch or a different ref |
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
string.split('.').each_with_index.inject([""]){|a, i| a+[a[i[1]]+"."+i[0]]}.reject(&:empty?).map{|a| a[1..-1]}.join(" && ") |
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/awk -f | |
# A simple script to copy a file with a path matching a pattern | |
# and then optionally replace that pattern with a different string | |
# in the file name | |
# | |
# Usage: ./cp_and_rename.awk -v subject=[foo] -v replacement=[bar] \ | |
# -v dest_prefix=[baz] | |
# | |
# E.g. |
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
########################### GTEST | |
# Enable ExternalProject CMake module | |
INCLUDE(ExternalProject) | |
# Set default ExternalProject root directory | |
SET_DIRECTORY_PROPERTIES(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/third_party) | |
# Add gtest | |
# http://stackoverflow.com/questions/9689183/cmake-googletest | |
ExternalProject_Add( |
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
load 'deploy/assets' | |
namespace :deploy do | |
namespace :assets do | |
desc 'Run the precompile task locally and rsync with shared' | |
task :precompile, :roles => :web, :except => { :no_release => true } do | |
%x{bundle exec rake assets:precompile} | |
%x{rsync --recursive --times --rsh=ssh --compress --human-readable --progress public/assets #{user}@#{host}:#{shared_path}} | |
%x{bundle exec rake assets:clean} | |
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
FILE *output = popen("su -c 'cat /var/lock/naoqi.lock'", "r"); | |
char buffer[256]; | |
fgets(buffer, sizeof(buffer), output); | |
char command[256] = "kill -9 "; | |
strcat(command, buffer); | |
printf("command %s\n", command); | |
system(command); |
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
#include <cstdlib> | |
#include <iostream> | |
#include <fstream> | |
#include <netdb.h> | |
#include <arpa/inet.h> | |
#include <netinet/in.h> | |
#include <time.h> | |
#include <sys/time.h> |
NewerOlder