Skip to content

Instantly share code, notes, and snippets.

func session(_ session: WCSession, didReceive file: WCSessionFile ) {
count+=1
let data: NSData = NSData( contentsOf: file.fileURL )!
if(file.fileURL.absoluteString.contains("qr")){
print(count,file.fileURL.absoluteString)
QRImage = UIImage( data: data as Data )!
self.QRImageView.setImage(QRImage)
}
var url:URL = URL(string:"https://twitter.com/"+textField.text!+"/profile_image?size=bigger")!
var err: NSError?;
var imageData :NSData = try! NSData(contentsOf: url, options: NSData.ReadingOptions.mappedIfSafe);
var img = UIImage(data:imageData as Data);
var IconImagePath: String {
let doc = NSSearchPathForDirectoriesInDomains( .documentDirectory, .userDomainMask, true )[0] as String
return ( doc as NSString ).appendingPathComponent("icon_send.jpg" )
}
@IBAction func pushImmageButton(_ sender: Any) {
let ciFilter = CIFilter(name: "CIQRCodeGenerator")
ciFilter?.setDefaults()
let baseUrlString="https://twitter.com/"
let qrString = baseUrlString+textField.text!
let data = qrString.data(using: String.Encoding.utf8)
ciFilter?.setValue(data, forKey: "inputMessage")
ciFilter?.setValue("L", forKey: "inputCorrectionLevel")
#! /usr/bin/env python
# coding: utf-8
# coding=utf-8
# -*- coding: utf-8 -*-
# vim: fileencoding=utf-8
import sys
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
import io
#! /usr/bin/env python
# coding: utf-8
# coding=utf-8
# -*- coding: utf-8 -*-
# vim: fileencoding=utf-8
import sys
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
import io
using UnityEngine;
using System;
using System.Collections;
using System.Net;
using System.IO;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using MiniJSON;
#include <dlib/opencv.h>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <dlib/image_processing/frontal_face_detector.h>
#include <dlib/image_processing/render_face_detections.h>
#include <dlib/image_processing.h>
#include <dlib/gui_widgets.h>
#include <sys/types.h>
#include <sys/socket.h>
require 'discordrb'
require "csv"
#client_idはbotに設定されているものを入力 prefixはコマンドの呼び出しの時の記号(!play 等の!部分 ?とかでも可)
bot = Discordrb::Commands::CommandBot.new token: '自分のトークン', client_id: 000000000000, prefix: '!'
#スプラトゥーンの武器名が入っているcsvファイルを読み込み
data = CSV.read('buki.csv')
bot.command :random_buki do |event|
server = bot.servers.first[1]
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import json
import os
@tak-km
tak-km / nfctest.py
Created May 16, 2017 05:48
readNFC
import binascii
import nfc
import pandas as pd
import urllib
import urllib2
class MyCardReader(object):
def on_connect(self, tag):
print "touched"