Skip to content

Instantly share code, notes, and snippets.

View sash13's full-sized avatar

Aleksander Ryzhkov sash13

  • Kyiv, Ukraine
  • 21:25 (UTC +03:00)
View GitHub Profile
@sash13
sash13 / fail
Created November 12, 2009 18:24
NSArray *words = [content componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSEnumerator *en = [words objectEnumerator];
NSString *word;
NSMutableArray *ssl = [[NSMutableArray alloc] initWithCapacity:1];
while(word = [en nextObject])
{
if([word hasPrefix:@"http://"])
{
NSLog(@"%@",word);
[ssl addObject:word];
'''for mass unfollow bot and another fucking user
use: download http://code.google.com/p/python-twitter/ this and use http://python-twitter.googlecode.com/issues/attachment?aid=6509573335595538436&name=friends-followers-cursor.patch this patch '''
import twitter
api = twitter.Api(username='user', password='pass')
friends_list = api.GetFriends()
followers_list = api.GetFollowers()
-(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *myTouch = [touches anyObject];
CGPoint location = [myTouch locationInView: [myTouch view]];
location = [[CCDirector sharedDirector] convertToGL: location];
mouse2 = cpMouseNew(space);
cpMouseGrab(mouse, cpv(location.x, location.y), 0);
Const n=8;
Var a:array[1..n] of integer;
i,k: integer;
begin
writeln('Введите 8 чисел, после каждого числа нажимайте Enter');
For i:=1 to n do read(a[i]); readln;
k:=0;
For i:=1 to n do
if a[i] =0 then begin
k:=k+1;
# -*- coding: utf8 -*-
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import urlfetch
from google.appengine.ext import db
from google.appengine.api import mail
from google.appengine.api.labs import taskqueue
from BeautifulSoup import BeautifulStoneSoup
import string
kal_uint8 i2c_tp_Readid(void)
{
kal_uint8 lcd_id = 0xff;
///kal_uint32 savedMask;
kal_uint8 readid_cnt=0;
kal_uint8 readata;
//////tp_i2c_crystal_on();
//////i2c_tp_hw_init();
//I2C_TOUCH_INIT();
@sash13
sash13 / oplayer.py
Created September 18, 2011 10:01
Open Player music grabber
# -*- coding: utf-8 -*-
import urllib
import urllib2
import re
import os
import json
from BeautifulSoup import BeautifulSoup
urllib2.install_opener(urllib2.build_opener(urllib2.HTTPCookieProcessor))
Bus 002 Device 005: ID 1b3f:2002 Generalplus Technology Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x1b3f Generalplus Technology Inc.
@sash13
sash13 / ml2srt.py
Created October 15, 2011 10:09
Machine Learning local --> SRT
from xml.dom.minidom import parse
import os
def getText(nodelist):
rc = []
for node in nodelist:
if node.nodeType == node.TEXT_NODE:
rc.append(node.data)
return ''.join(rc)
@sash13
sash13 / toe.py
Created October 21, 2011 18:55
Расчет ТОЭ схем в Python
from math import *
def toExpForm(a,s):
if a.real != 0:
real=sqrt(pow(a.real,2)+pow(a.imag,2))
agle=degrees(atan(a.imag/a.real))
else:
real=a.imag
agle=90.0 if a.imag>0 else -90.0
print (s+'='+str(round(a.real,3))+'','' if a.imag<0 else '+', str(round(a.imag,3))+'='+str(round(real,3)) + '∠' + str(round(agle,3)))