start new:
tmux
start new with session name:
tmux new -s myname
import stripe | |
stripe.api_key = 'tGN0bIwXnHdwOa85VABjPdSn8nWY7G7I' | |
print "Attempting charge..." | |
resp = stripe.Charge.create( | |
amount=200, | |
currency='usd', | |
card={ |
def using_mock(): | |
import mock | |
from django.core.files import File | |
file_mock = mock.MagicMock(spec=File, name='FileMock') | |
def using_tempfile(): | |
import tempfile |
# 보면 이런식으로 여러줄의 라인을 한 줄로 만들 수 있습니다. | |
# style 1 | |
current_id = return_response.data["id"] | |
current_banking = LOLOBanking.objects.get(id=current_id) | |
current_banking.related_id = withdraw_account_id | |
current_banking.withdraw_type = withdraw_type | |
current_banking.bank_type = wa.bank_type | |
current_banking.save |
a = ['Hello', 'Sydney', 'I', 'Am'] | |
b = [1, 2, 3, -1212.022, 5523, 232441, 1000] | |
# way 1 방법1 | |
with open("foo.txt", "w") as f: | |
map(lambda var: f.write(str(var)) if var == b[-1:][0] else f.write(str(var) + " "), b) | |
# way 2 방법2 | |
with open("foo.txt", "w") as f: |
import unittest | |
from os import urandom | |
import mock | |
def simple_urandom(length): | |
return 'f' * length | |
class TestRandom(unittest.TestCase): |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
from os import urandom | |
import mock | |
import unittest | |
import pytest | |
from fots import abc_urandom |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import unittest | |
import mock | |
import pytest | |
from fots import abc_urandom, my_random |
package main | |
import ( | |
"beegoorm/models" | |
"fmt" | |
"github.com/astaxie/beego" | |
"github.com/astaxie/beego/orm" | |
_ "beegoorm/routers" | |
_ "github.com/go-sql-driver/mysql" |
import ( | |
"github.com/astaxie/beego" | |
) | |
func (c *AdminController) Logindo() { | |
username := c.GetString("username") | |
c.SetSession("Adminname", username) //设置Session | |
adminName := c.GetSession("Adminname") //读取Session | |
c.DelSession("Adminname") //删除Session | |
c.TplNames = "admin/login.html" | |
} |