Skip to content

Instantly share code, notes, and snippets.

View themactep's full-sized avatar

Paul Philippov themactep

View GitHub Profile
Emerge Kernel sources
$ sudo -s
# emerge -uva sys-kernel/gentoo-sources
# cd /usr/src/linux
Copy recent kernel config to start with it
# zcat /proc/config.gz > .config
# make menuconfig
REM ***** BASIC *****
'
' Get-a-Clue : OTR Global Grid parser
' (c) 2008 Paul Philippov, themactep.com
' version 2008-10-20 13:59
'
Option Explicit
Sub ExportQuotesToNewDocument
Dim OpenProperties(1) as New com.sun.star.beans.PropertyValue
@themactep
themactep / bug.js
Created March 8, 2010 22:39 — forked from maccman/bug.js
// Is this a JavaScript bug?
// Running the code below alert's "three".
var calls = ["one", "two", "three"]
for(var i in calls) {
var name = calls[i];
this[name] = function(){
alert(name);
}
}
script/generate scaffold RedRose vs script/generate scaffold red_rose
<%= controller_name %> # RedRoses red_roses !!
<%= controller_class_path %> #
<%= controller_file_path %> # red_roses red_roses
<%= controller_class_nesting %> #
<%= controller_class_nesting_depth %> # 0 0
<%= controller_class_name %> # RedRoses RedRoses
<%= controller_underscore_name %> # red_roses red_roses
<%= controller_singular_name %> # RedRose red_rose !!
#
# a request to http://lastfm-api-ext.appspot.com/2.0/
# with outtype=js sometimes gives me an error like this:
#
Traceback (most recent call last):
File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 507, in __call__
handler.get(*groups)
File "/base/data/home/apps/lastfm-api-ext/1.178/main.py", line 60, in get
result = packages[package](params)[method]()
<?php
// php equivalent of ruby one-liner
// "строка текста!".chars.to_a.last
function u_str_split($string, $split_length=1)
{
preg_match_all('`.`u', $string, $arr);
$arr = array_chunk($arr[0], $split_length);
$arr = array_map('implode', $arr);
return $arr;
<pre>
<%= "<em>text</em>".class %>
<%= raw("<em>text</em>").class %>
<%= "<em>text</em>" %>
<%= raw("<em>text</em>") %>
<%= ["<em>text</em>"].join %>
<%= [raw("<em>text</em>")].join %>
@themactep
themactep / formtocookie.js
Last active July 24, 2017 15:30
How to save form to cookies, restore form from cookies. Requires jQuery and jQuery Cookie plugin.
/*
* Save Form To Cookie
* (cc) Paul Philippov, themactep@gmail.com
*
* This is rather a proof of concept than a production-ready solution.
* It does not handle all kinds of fields.
* You might want to extend it to suit your needs.
*
* Requirements:
*
@themactep
themactep / swirl.rb
Created November 22, 2012 09:28
Outward spiral matrix builder
#!/usr/bin/env ruby
#
# Outward spiral matrix builder
# 2012, Paul Philippov <themactep@gmail.com>
#
def show_usage
puts 'Usage: $0 <number>'
exit
end
#!/bin/sh
#
# Binary file padder.
# Pads binary file with 0xFF to match full size of flashing chip.
#
# Example:
# ./binpadder.sh openipc-u-boot-t10-universal.bin 8
#
# Running this command will produce a new binary file
# openipc-u-boot-t10-universal-8MB-padded.bin