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 / 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]);
<?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
<?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>
@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
@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 / log4j.xml
Created October 11, 2014 02:03
Complex Example
<?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>
<?php
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
function get_fname($string, $sub) {
$bad = array("<", ">", ":", '"', "/", "\\", "|", "?", "*");
$name = str_replace($bad, "_", $string);
echo strlen(utf8_decode($string));
if (strlen($string) > $sub) {
$name = mb_substr($string,0,$sub, "utf-8");
}
@damiann
damiann / face_replace.py
Created January 6, 2016 21:03 — forked from robertskmiles/face_replace.py
A script to automatically replace faces in group photos
#!/usr/bin/python
# face_replace.py
# Usage: python face_replace.py <image_file> [face index]
import sys
from opencv.cv import *
from opencv.highgui import *
from PIL import Image, ImageEnhance
import random
@damiann
damiann / gist:dac6857601f48de6c3e87c90f1d09c12
Created July 11, 2016 02:32
Random Generated Background
<p style="line-height: 18px; font-size: 18px; font-family: times;">
<script>
for (var line=1; line<60; line++) {
for(var i=1;i<29;i++) {
var s = (Math.floor((Math.random()*2)%2)) ? "╱" : "╲";
document.write(s);
}
document.writeln("<br>");
}
@damiann
damiann / gist:84adad982e71fbb510b95e482064a0e4
Created July 11, 2016 02:32
Random Generated Background
<p style="line-height: 18px; font-size: 18px; font-family: times;">
<script>
for (var line=1; line<60; line++) {
for(var i=1;i<29;i++) {
var s = (Math.floor((Math.random()*2)%2)) ? "╱" : "╲";
document.write(s);
}
document.writeln("<br>");
}