Skip to content

Instantly share code, notes, and snippets.

View damiann's full-sized avatar
🏴
Ę̮̱͔͓ͯ͗ͫ̌̏ͫ͌́x̘̤͚̰̫̫̗̤̱̒̓ͨͯ͑̓ͥͫ̕å̰͚̓͒ͫm̛̤͕̫̳̺̩̄̓ͨͥ͜ͅp̰͉͗ͤl̵̖̗̫͍͓͋̍̐͌̐̒e̡̧̿͒͋̈́͡

Damian damiann

🏴
Ę̮̱͔͓ͯ͗ͫ̌̏ͫ͌́x̘̤͚̰̫̫̗̤̱̒̓ͨͯ͑̓ͥͫ̕å̰͚̓͒ͫm̛̤͕̫̳̺̩̄̓ͨͥ͜ͅp̰͉͗ͤl̵̖̗̫͍͓͋̍̐͌̐̒e̡̧̿͒͋̈́͡
View GitHub Profile
@damiann
damiann / find_least_common.py
Last active August 29, 2015 14:07
Python Challenge #2
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
@damiann
damiann / install.sh
Created October 2, 2014 04:28
Install Ubuntu
#!/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
<?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>
<?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
@damiann
damiann / ocean.js
Last active August 29, 2015 14:03
D3.js Ocean Experiment
//<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]);
@damiann
damiann / gist:b5ebf594188a7fff76ee
Last active August 29, 2015 14:02
CentOS 6 (VirtualBox)
# 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
# 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"
@damiann
damiann / gist:6906b3e534cda753f3fe
Created May 16, 2014 18:26
ls -> dir (windows)
echo dir %1 > %systemroot%\system32\ls.bat
@damiann
damiann / gol
Created January 31, 2014 00:45
/*
* Conway's "Life"
*
* Adapted from the Life example
* on the Processing.org site
*
* Needs FrequencyTimer2 library
*/
#include <FrequencyTimer2.h>
> oclHashcat64.exe -m 500 example.hash example.dict