Skip to content

Instantly share code, notes, and snippets.

View RaVbaker's full-sized avatar
drinking coffee

Rafal Piekarski RaVbaker

drinking coffee
View GitHub Profile
@RaVbaker
RaVbaker / updates i 404
Created September 3, 2009 09:18
debug problemu z feeder.bliptools.pl
DEBUG MSG:
DATA: Array
(
[update[body]] => RT @paidContentUK Spotify Says Apple Still Testing iPhone App, ‘Spotify’ Vanishes From App Store | paidContent:UK http://cnt.to http://bit.ly/xyaeS !flaker
)
CURLOPTS: Array
(
[CURLOPT_POST] => 1
# Drop this file in config/initializers to run your Rails project on Ruby 1.9.
# This is three separate monkey patches -- see comments in code below for the source of each.
# None of them are original to me, I just put them in one file for easily dropping into my Rails projects.
# Also see original sources for pros and cons of each patch. Most notably, the MySQL patch just assumes
# that everything in your database is stored as UTF-8. This was true for me, and there's a good chance it's
# true for you too, in which case this is a quick, practical solution to get you up and running on Ruby 1.9.
#
# Andre Lewis 1/2010
# encoding: utf-8
@RaVbaker
RaVbaker / LICENSE.txt
Created May 20, 2011 07:54 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
Copyright (c) 2011 YOUR_NAME_HERE, YOUR_URL_HERE
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@RaVbaker
RaVbaker / .bash_profile
Last active September 26, 2015 19:08
My private .bashrc file.
export PATH="/usr/local/mysql/bin:~/bin:$PATH"
homebrew=/usr/local/bin:/usr/local/sbin
export PATH=$homebrew:$PATH
export JSTESTDRIVER_HOME="/Users/ravbaker/projekty/jstest"
export NODE_PATH="/usr/local/lib/node:/usr/local/lib/node_modules"
export BUNDLER_EDITOR="subl"
export EDITOR="vim"
test "$TERM" == 'xterm-color' && [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
@RaVbaker
RaVbaker / iOS5_update_checker.command
Created October 12, 2011 15:40
iOS5 software update notifier
#! /bin/csh
while (1)
curl -s -L http://phobos.apple.com/version | grep -i Restore | grep -i "\(iPhone\|iPad\|iPod\)" | grep -i "5\.0"
if ($? == 1) then
echo "Nothing yet..."`date`
else
say "iOS FIVE POINT OH FIRMWARE IS NOW AVAILABLE"
endif
sleep 13
end
@RaVbaker
RaVbaker / new-lang-code-file.php
Created November 6, 2011 00:34
How to create new programming language in PHP?
// This is written in pseudo language
class Foo {
def bar() {
ret "it Works!";
}
}
$f = Foo.new();
print $f.bar();
@RaVbaker
RaVbaker / retina_replace.js
Created March 25, 2012 17:44
Retina replace
// retina_replace.js - Maciej Nowakowski <macnow@gmail.com> Twitter: @macnow - more: http://macnow.pl/ios/retina/
function RetinaReplace(){
function RetinaCheck(el){
var url = el.src.replace(/\.(gif|png|jpg)$/gi, "_2x.\$1");
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("HEAD", url, true);
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4){
if(xmlhttp.status==200)
@RaVbaker
RaVbaker / readme.md
Created March 29, 2012 19:15
[HOWTO] SSH login without password

SSH login without password

Your aim

You want to use Linux and OpenSSH to automize your tasks. Therefore you need an automatic login from host A / user a to Host B / user b. You don't want to enter any passwords, because you want to call ssh from a within a shell script.

How to do it

First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:

@RaVbaker
RaVbaker / readme.md
Created March 30, 2012 20:12
[HOWTO] Rewrite all urls to one index.php in Apache

Redirect All Requests To Index.php Using .htaccess

In one of my pet projects, I redirect all requests to index.php, which then decides what to do with it:

Simple Example

This snippet in your .htaccess will ensure that all requests for files and folders that does not exists will be redirected to index.php:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

@RaVbaker
RaVbaker / readme.md
Last active October 23, 2019 15:27
[HOWTO] Forward ports a.k.a. make SSH Tunneling

Syntax:

ssh -L localport:host:hostport user@ssh_server -N 

where:

  • -L - port forwarding parameters (see below)
  • localport - local port (chose a port that is not in use by other service)
  • host - server that has the port (hostport) that you want to forward
  • hostport - remote port