Skip to content

Instantly share code, notes, and snippets.

View kdauzickas's full-sized avatar

Karolis Daužickas kdauzickas

View GitHub Profile
SetActiveLib -work
comp -include "$dsn\src\Komponentai.vhd"
comp -include "$dsn\src\Naturali_Top.vhd"
comp -include "$dsn\src\TestBench\Naturali_Top_TB.vhd"
asim +access +r TESTBENCH_FOR_Naturali_top
wave
wave -noreg sinchr1
wave -noreg sinchr2
wave -noreg sinchr3
wave -noreg sinchr4
@kdauzickas
kdauzickas / one-way-sync.sh
Last active August 29, 2015 13:56
One way folder synchronisation. Changes in source are replicated at target. Changes at target stay there.
#!/bin/sh
# Dir to watch
SOURCE_DIR="/tmp/source/"
# Dir to sync
TARGET_DIR="/tmp/target/"
inotifywait -mr --timefmt '%y-%m-%d %H:%M' --format '%T %w %f %e' \
-e modify \
-e attrib \
@kdauzickas
kdauzickas / helper.js
Created June 11, 2013 13:45
Handlebars {{#and}} helper. When you need variable amount of values to AND together.
// var context = {foo: true, bar: false, baz: true}
// {{#and foo baz}}Yup{{else}}Nope{{/and}} -> Yup
// {{#and bar baz qux}}Yup{{else}}Nope{{/and}} -> Nope
Handlebars.registerHelper('and', function() {
var fncType = toString.call(function(){});
for (var i = 0; i < arguments.length - 1; i++) {
var arg = arguments[i];
if (toString.call(arg) === fncType) {
arg = arg.call(this);
@kdauzickas
kdauzickas / helper.js
Last active December 18, 2015 08:49
Handlebars {{#or}} helper. When you need variable amount of values to OR together.
// var context = {foo: true}
// {{#or foo bar baz}}Yup{{else}}Nope{{/or}} -> Yup
// {{#or bar baz}}Yup{{else}}Nope{{/or}} -> Nope
Handlebars.registerHelper('or', function() {
var fncType = toString.call(function(){});
for (var i = 0; i < arguments.length - 1; i++) {
var arg = arguments[i];
if (toString.call(arg) === fncType) {
arg = arg.call(this);
@kdauzickas
kdauzickas / gravatar.sh
Created March 11, 2013 14:33
Use gravatar image as user image. Works with Fedora 18, not tested with any other distro/version
#! /bin/bash
me=$(logname)
echo "Type in the email you use with gravatar: "
read email
md5=$(echo -n $email | md5sum | cut -f1 -d' ')
echo "Fetching image to /var/lib/AccountsService/icons/$me..."
wget --quiet http://www.gravatar.com/avatar/$md5?s=128 --output-document="/var/lib/AccountsService/icons/$me"
echo "Setting image..."
echo Icon=/var/lib/AccountsService/icons/$me >> /var/lib/AccountsService/users/$me
echo "Done"