Skip to content

Instantly share code, notes, and snippets.

@ruter
ruter / upload_file.py
Last active December 19, 2018 11:23
[上传文件 Controller] Odoo 上传文件 Controller #Odoo
@http.route('/api/v1/mro/upload_file', type='http', auth="user", method=['POST'], website=True, csrf=False)
def upload_requirement_file(self, ufile, res_id=0, res_model, **kwargs):
file = ufile
if file:
# 附件模型
Attachment = request.env['ir.attachment']
# 创建附件
attach = Attachment.create({
'name': file.filename,
'res_model': res_model,

Install x264

cd ~
git clone git://git.videolan.org/x264
cd x264
./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl
make -j4
sudo make install
@marcelitocs
marcelitocs / golang-on-rpi.md
Last active July 1, 2023 22:24 — forked from konradko/golang_on_rpi.md
Install Golang 1.8 on Raspberry Pi
wget https://storage.googleapis.com/golang/go1.8.linux-armv6l.tar.gz
tar -C /usr/local -xzf go1.8.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin
@Ron3
Ron3 / History|-104b39d1|entries.json
Last active May 21, 2022 09:59
AWS Lambda初触
{"version":1,"resource":"file:///Users/ron/Documents/Work/Github/WastedLand_Unity/Assets/Code/BPGames/BPMono/BPMainController.cs","entries":[{"id":"asRE.cs","timestamp":1653017452369},{"id":"1N1A.cs","timestamp":1653017490920},{"id":"ZcIB.cs","timestamp":1653017517999},{"id":"1sWI.cs","timestamp":1653018848615},{"id":"b2y6.cs","timestamp":1653033123307},{"id":"p0fY.cs","timestamp":1653033276547},{"id":"SurA.cs","timestamp":1653033301622},{"id":"8aiu.cs","timestamp":1653033472606},{"id":"4qe9.cs","timestamp":1653038794506},{"id":"m05x.cs","timestamp":1653038809996},{"id":"8dkr.cs","timestamp":1653038832762},{"id":"xxRB.cs","timestamp":1653039127616},{"id":"1IX0.cs","timestamp":1653040123957}]}
@582033
582033 / python
Created June 28, 2016 07:02
树莓派获取[cpu温度/cpu使用率/内存空闲率]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
显示树莓派cpu温度、使用率及内存使用率
'''
import os
def show_temp():
file = open("/sys/class/thermal/thermal_zone0/temp")
@selfboot
selfboot / centos_python.sh
Last active June 8, 2023 14:11
CentOS 6.8: Install Python 2.7.10, pip, virtualenv, and virtualenvwrapper on CentOS
#!/bin/bash
# According to:
# How To Set Up Python 2.7.6 and 3.3.3 on CentOS 6.4
# https://www.digitalocean.com/community/tutorials/how-to-set-up-python-2-7-6-and-3-3-3-on-centos-6-4
yum -y update
yum groupinstall -y 'development tools'
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel
yum install xz-libs
wget http://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz
@binderclip
binderclip / flask-mail-qq.py
Created August 4, 2015 07:48
用 Flask-Mail 通过 QQ 邮箱发送邮件
from flask import Flask
from flask_mail import Mail, Message
app = Flask(__name__)
app.config.update(
#EMAIL SETTINGS
MAIL_SERVER='smtp.qq.com',
MAIL_PORT=465,
MAIL_USE_SSL=True,
@binderclip
binderclip / python-smtp-send-qq-mail.py
Last active February 16, 2023 14:59
Python & Email,附上用 Python 发送 QQ 邮箱邮件的代码
import smtplib
from getpass import getpass
def prompt(prompt):
return input(prompt).strip()
fromaddr = prompt("From: ")
toaddrs = prompt("To: ").split()
subject = prompt("Subject: ")
print("Enter message, end with ^D (Unix) or ^Z (Windows):")
# -*- coding: utf-8 -*-
#
# Author: oldj
# Email: oldj.wu@gmail.com
# Blog: http://oldj.net
#
import os
import re
import StringIO
@nickytoh
nickytoh / iCloud API Demo in Node.js
Last active September 6, 2021 03:11
Request Contact List From iCloud
var uuid = require('node-uuid'),
https = require('https');
function iCloud(appleId, password) {
this.urls = {
"version" : "https://www.icloud.com/system/version.json",
"validate": "/setup/ws/1/validate?clientBuildNumber={0}&clientId={1}",
"login": "/setup/ws/1/login?clientBuildNumber={0}&clientId={1}"
}