Skip to content

Instantly share code, notes, and snippets.

View ebababi's full-sized avatar

Nikolaos Anastopoulos ebababi

View GitHub Profile
@ebababi
ebababi / functions.php
Created October 4, 2011 12:42
Cache FeedBurner circulation (subscribers) results in PHP
<?php
function get_feedburner_circulation($feedburner_id, $ttl = 86400) {
$cache = dirname(__FILE__) . '/cache/feedburner.txt';
// Check cache validity
if ( !file_exists($cache) || ( filemtime($cache) + $ttl - time() < 0 ) ) {
// try to get the feed data
$curl = curl_init('https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=' . $feedburner_id);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
@ebababi
ebababi / README
Created November 29, 2012 12:35
MARS ROVER TEST: Simulation of a squad of robotic rovers that are to be landed by NASA on a plateau on Mars executing movement instructions
= MARS ROVER TEST
A squad of robotic rovers are to be landed by NASA on a plateau on Mars. This
plateau, which is curiously rectangular, must be navigated by the rovers so
that their on-board cameras can get a complete view of the surrounding
terrain to send back to Earth.
A rover's position and location is represented by a combination of x and y
co-ordinates and a letter representing one of the four cardinal compass
points. The plateau is divided up into a grid to simplify navigation. An
@ebababi
ebababi / README
Created November 29, 2012 12:38
PINGPONG TEST: A small ping pong front end app in HTML5
= PINGPONG TEST
Can you make a small ping pong front end app with HTML5? Basically it has 2
square wall and can kick the ball the each other, don't think it to be very
complicated, you should be able to finish this within 3 hours. Just want to see
a ball can be kicked from left to right and from right to left, and the ball
can be a square as well.
== Citations
#!/bin/bash
# This script is edited by Brice Dutheil
# See there in french http://blog.arkey.fr/2012/07/30/script-pour-installer-le-jdk-5-sur-macosx-lion/
# Translate button is broken for now, please use Google to translate this website.
#
# 2014/02/10 Updated the script to run on OSX 10.9 Maverick
#
# 2013/05/11 Added a few more guidance when Java Preferences is not available anymore
# Added a simple example of a JDK switch function.
@ebababi
ebababi / find_value.rb
Created March 27, 2015 14:24
Ruby core extension for Array#find_value which compares each entry in enum with value or passes to block and returns the value for the first for which the evaluated value is non-false.
class Array
# Compares each entry in enum with value or passes to block. Returns the value
# for the first for which the evaluated value is non-false. If no object
# matches, returns the default value or nil.
#
# If neither block nor argument is given, an enumerator is returned instead.
#
# find_value(value, default = nil) → obj or default
# find_value(default = nil) { |obj| block } → obj or default
# find_value → an_enumerator

Keybase proof

I hereby claim:

  • I am ebababi on github.
  • I am ebababi (https://keybase.io/ebababi) on keybase.
  • I have a public key ASDI_e5Y0z3pWSrtD1S6Xy2kzfmJwGTVEgyo0NS7948Cqwo

To claim this, I am signing this object:

@ebababi
ebababi / Dockerfile
Created November 10, 2019 20:17
Ruby on Rails Deployment Image: Builds a ready to be deployed image of a Ruby on Rails application.
# Ruby on Rails Deployment Image
#
# Builds a ready to be deployed image of a Ruby on Rails application.
# https://ebababi.net/dockerfile-for-ruby-on-rails-deployments.html
# Copyright (C) 2019 Nikolaos Anastopoulos, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@ebababi
ebababi / wmm.rsc
Created March 28, 2020 19:46
MikroTik RouterOS Script: Enable WMM in both wireless interfaces and create firewall rule setting WMM priority from DSCP.
# Enable WMM in both wireless interfaces (2.4GHz and 5Ghz) and create firewall
# rule setting WMM priority from DSCP value of IP packets headers.
#
# Resources:
# https://wiki.mikrotik.com/wiki/Manual:WMM
# https://forum.mikrotik.com/viewtopic.php?t=125152#p616385
/interface wireless
set [find default-name=wlan1] wmm-support=enabled
set [find default-name=wlan2] wmm-support=enabled
@ebababi
ebababi / ipv6-pppoe.rsc
Created March 28, 2020 19:52
MikroTik RouterOS Script: Configure DHCPv6-PD on the PPPoE interface.
# Configure DHCPv6-PD on the PPPoE interface.
#
# Prior script execution, enable IPv6 package:
# /system
# package enable ipv6
# reboot
#
# Resources:
# https://kb.pentanet.com.au/faq/how-to-configure-a-mikrotik-routerboard-router-to-accept-ipv6
# https://www.netdaily.org/tag/mikrotik-ipv6/
@ebababi
ebababi / ipv6-firewall.rsc
Created March 28, 2020 23:20
MikroTik RouterOS Script: Default configuration IPv6 firewall rules.
# Default configuration IPv6 firewall rules.
#
# Extracted from RouterOS 6.46.4 with:
# /system default-configuration print
/ipv6 firewall address-list
add address=::/128 comment="defconf: unspecified address" list=bad_ipv6
add address=::1/128 comment="defconf: lo" list=bad_ipv6
add address=fec0::/10 comment="defconf: site-local" list=bad_ipv6
add address=::ffff:0.0.0.0/96 comment="defconf: ipv4-mapped" list=bad_ipv6