Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

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

🏠
Working from home
View GitHub Profile
@majioa
majioa / MainActivity.java
Created Jul 5, 2012 — forked from romannurik/SwipeDismissListViewTouchListener.java
**BETA** Android 4.0-style "Swipe to Dismiss" sample code
View MainActivity.java
// 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 Sep 26, 2012
Sample function in a post model to share to the post Facebook and Twitter
View Gemfile
gem 'koala'
gem 'bitly', '~> 0.8.0'
gem 'twitter'
@majioa
majioa / .bashrc
Created Oct 1, 2012
Bash .bashrc sample
View .bashrc
# 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 Oct 5, 2012
Some trick on c language
View triks.c
// 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 Jan 23, 2013
Getting the Ring0 level for x86 processor series (guess i386, i486, and may be next generations)
View ring0.asm
;Как получить привелегию Ring 0
;Автор: The GSGR
;Иногда это нужно для доступа к портам выше $FF, таких как IDE контроллер и т.д.
;--------------------------------------------------
.386p
.model flat
.radix 16
Ring_0_CS_32 = 28
@majioa
majioa / procmon.rb
Created Jan 23, 2013
Simple process monitor tool like `top` in ruby for linux.
View procmon.rb
#!/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 Jan 23, 2013
Simple FTP mirroring tool in Ruby
View mirrorer.rb
#!/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 Jan 23, 2013
Sample downloader tool in Ruby. it reads HTTP or FTP sites from /local/misc/misc/sites and stores results into /local/misc/mirrors.
View downloader.rb
#!/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 Jan 23, 2013
The code adds a comment into old DOS created zip-archive.
View zipcomm.asm
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 Jan 24, 2013
Sample CMOS utils for DOS. They allows to write and read PC CMOS.
View cmosr.asm
.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