Skip to content

Instantly share code, notes, and snippets.

View akostadinov's full-sized avatar

Aleksandar N. Kostadinov akostadinov

View GitHub Profile
@kpiwko
kpiwko / scl_sudo
Created May 7, 2015 06:43
Red Hat SCL Sudo wrapper
#! /bin/sh
# TODO: parse & pass-through sudo options from $@
sudo_options="-E"
scls=$X_SCLS
#available_scls="`scl --list | tr '\n' ' ' | sed 's/ $//'`"
for arg in "$@"
do
case "$arg" in
*\'*)
@maxim
maxim / rails_load_path_tips.md
Last active April 13, 2023 13:28
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@ysb33r
ysb33r / RelativePath.groovy
Last active November 4, 2022 14:18
The Groovy way to obtain a relative path given two paths.
def root= new File('/usr/share')
def full= new File('/usr/share/docs/rpm-4.4')
// Print the relative path of 'full' in relation to 'root'
// Notice that the full path is passed as a parameter to the root.
def relPath= new File( root.toURI().relativize( full.toURI() ).toString() )
@natritmeyer
natritmeyer / Rakefile
Created June 10, 2013 13:49
How to add task dependencies to custom rake tasks that don't allow for the normal rake task behaviour around setting task dependencies.
# Example Rakefile that demonstrates how to add task dependencies
# to custom rake tasks that don't allow for the normal rake task
# behaviour around setting task dependencies.
require 'cucumber/rake/task'
# here's the task that I want to run before any of my cucumber tasks (see below)
namespace :stub do
desc "Start stub required by features"
task :start do
@jehrhardt
jehrhardt / KeyLengthDetector.java
Created March 15, 2013 06:23
Detect the allowed size of AES keys on the JVM. If the size is <= 256, it is limited. To fix it JCE unlimted stregth files are needed.
import javax.crypto.Cipher;
import java.security.NoSuchAlgorithmException;
public class KeyLengthDetector {
public static void main(String[] args) {
int allowedKeyLength = 0;
try {
allowedKeyLength = Cipher.getMaxAllowedKeyLength("AES");
} catch (NoSuchAlgorithmException e) {
@gregretkowski
gregretkowski / logger_trace.rb
Created October 11, 2012 16:25
Adding 'trace' to ruby Logger
require 'logger'
# Monkeypatch a 'trace' loglevel into ruby Logger
class Logger
module Severity; TRACE=-1;end
def trace(progname = nil, &block);add(TRACE, nil, progname, &block);end
def trace?; @level <= TRACE; end
end
l = Logger.new(STDERR)
l.level = Logger::TRACE
@olim7t
olim7t / git-standup.sh
Created October 1, 2012 08:44
git-standup: find out what you did yesterday (or last friday)
#!/bin/bash
# git-standup: find out what you did yesterday (or last friday).
#
# Setup:
# 1. Change AUTHOR if your git user doesn't match your unix account.
# 2. Save somewhere on your path, make executable.
# 3. git config --global alias.standup '!git-standup'
# 4. Profit.
#
# Original idea via @paulgreg (https://twitter.com/paulgreg/status/248686055727972352)
@phibo23
phibo23 / fb2ical.php
Last active October 5, 2015 12:47 — forked from cognitom/fb2ical.php
Export ical format for Facebook page's events by cognitom. Modifications: pageId as parameter, restriction to public events, improved timezone adjustment, ignore exceptions
<?php
/*
original code by cogitom: https://gist.github.com/997980/
This script reads future events (plus several days into the past) from Facebook pages
and creates a subscribable iCalendar
Improvements upon the original version:
- fixed start and endtime reading
- timezone adjustment done on facebook's side (more reliable)
@cognitom
cognitom / fb2ical.php
Created May 29, 2011 17:36
Export ical format for Facebook page's events
<?php
// https://github.com/facebook/php-sdk/
require_once 'path/to/facebook.php';
// http://www.kigkonsult.se/iCalcreator/
require_once 'path/to/iCalcreator.class.php';
$config = array(
'appId' => 'xxxx',//change to your fb app id
'secret' => 'yyyy',//change to your fb app secret
'pageId' => 'shimokitazawa.osscafe',//change to target fb page id