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
<?xml version="1.0" encoding="UTF-8"?> | |
<Configuration status="FATAL"> | |
<Properties> | |
<Property name="filename">/logs/error.log</Property> | |
<Property name="console-pattern">%m%n</Property> | |
<Property name="file-pattern">%d %p %t %c - %m%n</Property> | |
<Property name="smtp-ip">127.0.0.1</Property> | |
<Property name="smtp-user">test</Property> | |
<Property name="smtp-pass">test</Property> | |
<Property name="smtp-to">[email protected]</Property> |
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
import collections | |
# implemented method similar to Counter that keeps insert order | |
def find_least_common(s): | |
t = collections.OrderedDict() | |
for c in s: | |
if c in t: | |
t[c] = t[c]+1 | |
else: | |
t[c] = 1 |
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
#!/bin/sh | |
{ | |
echo "This script requires superuser access to install apt packages." | |
echo "You will be prompted for your password by sudo." | |
# clear any previous sudo permission | |
sudo -k | |
# run inside sudo | |
sudo sh <<SCRIPT |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<Configuration status="WARN"> | |
<Properties> | |
<Property name="filename">logs\customization.log</Property> | |
</Properties> | |
<Appenders> | |
<File name="file" fileName="${filename}"> | |
<PatternLayout> | |
<pattern>%d %p %t %c - %m%n</pattern> |
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
<?php | |
function is_true($val) { | |
return $val ? "true" : "false"; | |
} | |
$a = 1; | |
$a_test = is_true($a); | |
echo "(a) integer : $a_test \n"; | |
// returns: (a) integer : true |
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
//<script src="http://d3js.org/d3.v3.min.js"></script> | |
var margin = {top: 200, right: 0, bottom: 100, left: -100}, | |
width = 960 - margin.left - margin.right, | |
height = 500 - margin.top - margin.bottom; | |
var x = d3.scale.linear() | |
.domain([0, 5.0]) | |
.range([0, width]); |
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
# network | |
Go to VirtualBox → Preferences → select Network tab and create a Host-Only Network adapter (Adapter 1) | |
Go to VirtualBox → Preferences → select Network tab and create a NAT Network adapter (Adapter 2) | |
Boot up the VM | |
Open Terminal | |
ifconfig // should see eth0 and eth1 | |
# allow the host to see web server | |
sudo system-config-firewall |
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
# django | |
Vagrant.configure("2") do |config| | |
config.vm.define :djangovm do |django_config| | |
django_config.vm.box = "lucid32" | |
django_config.vm.network :forwarded_port, guest: 8000, host: 8001 | |
django_config.vm.synced_folder "../app/shared", "/home/vagrant/django" | |
django_config.vm.provision :chef_solo do |chef| | |
chef.cookbooks_path = "../app/cookbooks" | |
chef.add_recipe "apt" | |
chef.add_recipe "git" |
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
echo dir %1 > %systemroot%\system32\ls.bat |
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
/* | |
* Conway's "Life" | |
* | |
* Adapted from the Life example | |
* on the Processing.org site | |
* | |
* Needs FrequencyTimer2 library | |
*/ | |
#include <FrequencyTimer2.h> |