Skip to content

Instantly share code, notes, and snippets.

View yudanta's full-sized avatar

Yudanta yudanta

View GitHub Profile
@yudanta
yudanta / soundclouddl
Last active August 29, 2015 13:58
soundcloud downloader
#!/usr/bin/env python
#usage : python soundclouddl.py <soundcloud url track/list>
import soundcloud
import urllib
import re
import time
import os
import sys
@yudanta
yudanta / gist:c42da21b089692e31c92
Created August 3, 2014 12:34
prevent ascii error
#prevent ascii error
#place at the top of the file :D
import codecs
import sys
streamWriter = codecs.lookup('utf-8')[-1]
sys.stdout = streamWriter(sys.stdout)
@yudanta
yudanta / gist:6ecd7ac0388d8ea77769
Created August 4, 2014 12:23
sample post to gcm
<?php
$apiKey = "api_key";
$messageData = array(
"code" => 1001,
"subject" => "hai kak zam",
"messages" => "hai kak zam",
);
$registrationIdsArray = array("gcm_id");
@yudanta
yudanta / gist:a74fda922be59253337d
Created August 18, 2014 09:38
Python GCM Sample
#!/usr/bin/env python
import requests
import json
GCM_URL = "https://android.googleapis.com/gcm/send"
API_KEY = "your api key"
CLIENT_GCM = ["your device gcm_id"]
<?php
$url = "https://android.googleapis.com/gcm/send";
$api_key = "<api key>";
$client_id = array("gcm_id");
$headers = array(
"Content-type: application/json",
"Authorization: key=" . $api_key,
#!/usr/bin/env python
# how to use just create instance from this class, you can set client id or client secret from constructor
# Methods
# 1. get token get_token() //getting token key
# 2. check_token(token) // for checking tokon is valid or not
# 3. sending_sms(number, message, token, *args, **kwargs) //sending message => return message id
# 4. check_status_message(message_id, token, *args, **kwargs) //check status message
#
@yudanta
yudanta / smsclient.py
Created September 1, 2014 05:10
smsclient.py
#!/usr/bin/env python
# how to use just create instance from this class, you can set client id or client secret from constructor
# Methods
# 1. get token get_token() //getting token key
# 2. check_token(token) // for checking tokon is valid or not
# 3. sending_sms(number, message, token, *args, **kwargs) //sending message => return message id
# 4. check_status_message(message_id, token, *args, **kwargs) //check status message
#
@yudanta
yudanta / ImagickHelper.py
Created September 18, 2014 10:37
Python Image Resizer using Python Wand and ImageMagick (inspired by flickr style resize)
#!/usr/bin/env python
from wand.image import Image
#create class for get exif data from image
class ExifData:
key_exif = ['date:create',
'date:modify',
'exif:ApertureValue',
@yudanta
yudanta / stemmer.py
Created October 5, 2014 13:55
Stemmer: porting from Ivan Lanin Stemmer
#!/usr/bin/env python
'''
stemmer porting from ivanlanin stemmer (php script)
https://github.com/ivanlanin/pengakar
'''
import sys
import re
@yudanta
yudanta / mindwave.py
Created February 9, 2015 08:54
mindwave
import select, serial, threading
# Byte codes
CONNECT = '\xc0'
DISCONNECT = '\xc1'
AUTOCONNECT = '\xc2'
SYNC = '\xaa'
EXCODE = '\x55'
POOR_SIGNAL = '\x02'
ATTENTION = '\x04'