Skip to content

Instantly share code, notes, and snippets.

View linmic's full-sized avatar

Linmic linmic

View GitHub Profile
@linmic
linmic / index.html
Created May 29, 2013 10:05
A CodePen by linmic. CSS Panorama Viewer - Since chrome has some weird buggy issues on css 3d transform/transition, I would suggest use safari to enjoy this.
<div id="pano_viewer">
<div id="cube_box">
<div id="cube">
<img class="front" src="http://s.cdpn.io/19243/front.JPG" width="3000" height="3000">
<img class="left" src="http://s.cdpn.io/19243/left.JPG" width="3000" height="3000">
<img class="right" src="http://s.cdpn.io/19243/right.JPG" width="3000" height="3000">
<img class="back" src="http://s.cdpn.io/19243/back.JPG" width="3000" height="3000">
<img class="top" src="http://s.cdpn.io/19243/up.JPG" width="3000" height="3000">
<img class="bottom" src="http://s.cdpn.io/19243/down.JPG" width="3000" height="3000">
</div>
import atomac
a=atomac.getAppRefByLocalizedName('Skype')
cloud_menu = a.AXChildren[2].AXChildren[0]
print cloud_menu
# Some apps are coded so menu items aren't populated until they're displayed
try:
cloud_menu.Press()
except atomac.ErrorCannotComplete:
# An accessibility bug you'll see sometimes - the app never reports
@linmic
linmic / tcp.py
Created December 29, 2013 04:57
listening tcp
#!/usr/bin/python
import socket
HOST = 'localhost' # use '' to expose to all networks
PORT = 515
def incoming(host, port):
"""Open specified port and return file-like object"""
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@linmic
linmic / udp.py
Created December 29, 2013 04:59
listen thru udp
#!/usr/bin/python
# receive udp packets from all interfaces
import socket
HOST = '' # use '' to expose to all networks
port = 5464
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>>> import atomac
>>> skype = atomac.getAppRefByLocalizedName('Skype')
>>> skype.findFirstR(AXRole='AXGrid').waitFor(10, 'AXResized') # type something in the current chat would result in its resizing
False
import time
import threading
import pyperclip
import bitly
# fill you auth
bitlyAPI = bitly.Api(login='', apikey='')
def get_short_url(url):
return bitlyAPI.shorten(url, {'history':1})
# http://snipplr.com/view/19446/datetime-string-conversion/
import datetime
d=datetime.datetime.now()
# datetime to string
print d.strftime("%d/%m/%Y %H:%M:%S")
# string to datetime
print d.strptime("14/11/1970 12:03:30","%d/%m/%Y %H:%M:%S")
@import "compass/css3/images";
// CSS-only multi-line ellipsis with generated content
// yields `position:relative`, so remember to declare an eventual `position:absolute/fixed` *after* including this mixin
@mixin limitLines(
$maxLinesPortrait, // Mandatory: The number of lines after which the clipping should take action.
$maxLinesLandscape: $maxLinesPortrait, // You may provide a different line limit for landscape orientation.
// Note that 'portrait' is our default orientation. However, if you omit $maxLinesLandscape,
// the value of $maxLinesPortrait is used for whatever orientation (that is, without a media query).
<html>
<head>
<script src="https://apis.google.com/js/client.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
function auth() {
var config = {
'client_id': 'OAUTH_CLIENT_ID',
'scope': 'https://www.google.com/m8/feeds'
};
@linmic
linmic / bluetooth.js
Last active August 29, 2015 14:06 — forked from revolunet/bluetooth.js
/*
Chrome Packaged app Bluetooth API test
Before interacting with a BT device, you need to :
1) get the device MAC and service UUID with startDiscovery and getServices methods
2) request permission with chrome.permissions.request
3) add the service profile with chrome.bluetooth.addProfile (a profile is only {uuid:'xxxxxxx...'})
*/
// onConnection callback
chrome.bluetooth.onConnection.addListener(