Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python3
# -*- coding: utf-8 -*
import sys
import serial
import time
def main(f, ser):
while True:
data = serial.to_bytes([0xA5,0x5A,0x02,0x80,0xaa])
ser.write(data)
package Mojo::IRC::Server;
$Mojo::IRC::Server::VERSION = "1.0.4";
use strict;
use Encode;
use Encode::Locale;
use Carp;
use Parse::IRC;
use Mojo::Webqq;
use Mojo::Util qw(md5_sum);
use Mojo::IOLoop;
@wxg4net
wxg4net / awesome-layout-firefox
Created April 24, 2015 00:31
awesome窗口程序固定布局
---------------------------------------------------------------------------
--- Fair layouts module for awful
--
-- @author wxg
-- @copyright 2015 Josh wxg
-- @release @AWESOME_VERSION@
-- @module awful.layout.suit.firefox
---------------------------------------------------------------------------
-- Grab environment we need
@wxg4net
wxg4net / webqq-fix
Created February 7, 2015 09:45
初始化好友在线状态
# _get_online_list_info.pm
use JSON;
use Webqq::Client::Util qw(console);
sub Webqq::Client::_get_online_list_info {
my $self = shift;
return undef if $self->{type} ne 'smartqq';
my $ua = $self->{ua};
my $api_url = 'http://d.web2.qq.com/channel/get_online_buddies2';
my %r = (
use IO::Socket::UNIX;
use JSON;
use AnyEvent;
use AnyEvent::Handle;
use Data::Dumper;
my $socket_path='/tmp/ddd.sock';
unlink $socket_path if -e $socket_path;
my $socket = IO::Socket::UNIX->new(
@wxg4net
wxg4net / webqq-pl
Created December 23, 2014 07:35
weechat webqq support test
#!/usr/bin/perl
use lib '/home/wxg/.weechat/perl/';
use Exporter 'import';
use Webqq::Client;
use Digest::MD5 qw(md5_hex);
use Encode;
use Encode::Locale;
use IO::Socket::UNIX;
use threads;
@wxg4net
wxg4net / git-ptc
Created April 22, 2014 13:52
git ptc for send email
#!/usr/bin/bash
num=1
if [ $# -gt 0 ]; then
num=$1
fi
git config --get core.email > /dev/null
if [ $? -ne 0 ]; then
exit 0
fi
# Maintainer: shadyabhi <abhijeet.1989@gmail.com>
# Author : Bram Cohen
pkgname=python2-google-api-python-client-hg
_realname=google-api-python-client
pkgver=1.2
pkgrel=1
pkgdesc="Google API Client for Python"
url="http://code.google.com/p/google-api-python-client/"
arch=('any')
#!/usr/bin/python2
# -*- coding: utf-8 -*-
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
import httplib2
from oauth2client.tools import run
from apiclient.discovery import build
#~ flow = flow_from_clientsecrets('client_secrets.json',
#~ scope='https://www.googleapis.com/auth/tasks',
#~ redirect_uri='urn:ietf:wg:oauth:2.0:oob')
@wxg4net
wxg4net / conky-cairo-imlib2
Created October 29, 2013 07:46
paint images in conky
require 'cairo'
require 'imlib2'
--~ require 'cairo_imlib2_helper'
--~ cairo_draw_image('/home/Data/pictres/500px/18.jpg' , cs, 0, 0, 0.2, 0.2)
function conky_images()
if conky_window == nil then return end
local sw = conky_window.width
local sh = conky_window.height
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, sw, sh)