Skip to content

Instantly share code, notes, and snippets.

View majioa's full-sized avatar
🏠
Working from home

Павел "Malo" Скрылёв majioa

🏠
Working from home
View GitHub Profile
@majioa
majioa / MainActivity.java
Created July 5, 2012 11:30 — forked from romannurik/SwipeDismissListViewTouchListener.java
**BETA** Android 4.0-style "Swipe to Dismiss" sample code
// THIS IS A BETA! I DON'T RECOMMEND USING IT IN PRODUCTION CODE JUST YET
/*
* Copyright 2012 Roman Nurik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@majioa
majioa / Gemfile
Created September 26, 2012 07:38
Sample function in a post model to share to the post Facebook and Twitter
gem 'koala'
gem 'bitly', '~> 0.8.0'
gem 'twitter'
@majioa
majioa / .bashrc
Created October 1, 2012 11:50
Bash .bashrc sample
# function to convert an mp3 to an ogg file
function mp3_to_ogg {
mp3=$1
wav=$(echo "$mp3"|sed "s/mp3$/wav/i")
ogg=$(echo "$mp3"|sed "s/mp3$/ogg/i")
artist=$(mp3info -p "%a\n" $mp3)
comment=$(mp3info -p "%c\n" $mp3)
genre=$(mp3info -p "%g\n" $mp3)
album=$(mp3info -p "%l\n" $mp3)
track=$(mp3info -p "%n\n" $mp3)
@majioa
majioa / triks.c
Created October 5, 2012 08:21
Some trick on c language
// Detection of an endianness in the run system.
int is_big_endian(void)
{
union {
uint32_t i;
char c[4];
} bint = {0x01020304};
return bint.c[0] == 1;
@majioa
majioa / ring0.asm
Created January 23, 2013 07:11
Getting the Ring0 level for x86 processor series (guess i386, i486, and may be next generations)
;Как получить привелегию Ring 0
;Автор: The GSGR
;Иногда это нужно для доступа к портам выше $FF, таких как IDE контроллер и т.д.
;--------------------------------------------------
.386p
.model flat
.radix 16
Ring_0_CS_32 = 28
@majioa
majioa / procmon.rb
Created January 23, 2013 07:23
Simple process monitor tool like `top` in ruby for linux.
#!/usr/bin/ruby
require 'thread'
require 'logger'
$KCODE = "utf-8"
class ProcMon < Logger::Application
def initialize()
super('ProcMon') # Name of the application.
end
@majioa
majioa / mirrorer.rb
Created January 23, 2013 07:32
Simple FTP mirroring tool in Ruby
#!/usr/bin/ruby
require 'net/ftp'
require 'net/http'
require 'fileutils'
class String
def to_l(srcl,dstl)
val = gsub(/(["'\&\(\)])/) { "\\" + $1 }
`echo #{val} |iconv -f #{srcl} -t #{dstl}`.sub(/\n/,"")
end
@majioa
majioa / downloader.rb
Created January 23, 2013 07:37
Sample downloader tool in Ruby. it reads HTTP or FTP sites from /local/misc/misc/sites and stores results into /local/misc/mirrors.
#!/usr/bin/ruby
require 'net/ftp'
require 'net/http'
require 'fileutils'
class String
def to_l(srcl,dstl)
val = gsub(/(["'\&\(\)])/) { "\\" + $1 }
`echo #{val} |iconv -f #{srcl} -t #{dstl}`.sub(/\n/,"")
end
@majioa
majioa / zipcomm.asm
Created January 23, 2013 12:07
The code adds a comment into old DOS created zip-archive.
ASSUME CS:CGR,DS:CGR
CGR GROUP COD,DAT
COD SEGMENT BYTE
ORG 100H
ZIPCOMM proc
LEA SI,C_
CALL WW
MOV SI,80H
MOV AH,'/'
CALL READ_FILE_STRING
@majioa
majioa / cmosr.asm
Created January 24, 2013 11:00
Sample CMOS utils for DOS. They allows to write and read PC CMOS.
.MODEL SMALL
COD SEGMENT PARA
ASSUME CS:COD,DS:COD
ORG 100H
START:
XOR AX,AX
MOV CX,256
LEA DI,BUF
PUSH CS
PUSH CS