This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def patch_django_shell(): | |
import os | |
import runpy | |
import sys | |
from functools import wraps | |
from unittest.mock import patch | |
from django.core.management.commands.shell import Command | |
original_handle = Command.handle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Profiles": [ | |
{ | |
"Thin Strokes": 0, | |
"Working Directory": "\/", | |
"Prompt Before Closing 2": false, | |
"Selected Text Color": { | |
"Green Component": 0, | |
"Blue Component": 0, | |
"Red Component": 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.protobuf import text_format | |
def ParseFromBinary(bytestr, message): | |
message.ParseFromString(bytestr) | |
def ParseFromText(string, message): | |
text_format.Merge(string, message) | |
def SerializeToBinary(message): | |
return message.SerializeToString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = ladyrick | |
email = ladyrick@qq.com | |
[alias] | |
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
[gui] | |
encoding = utf-8 | |
[i18n] | |
commitencoding = utf-8 | |
logoutputencoding = utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PyMsgBox(): | |
def __init__(self): | |
from tkinter import Tk, messagebox | |
self.msgbox = messagebox | |
self.root = Tk() | |
self.root.wm_attributes('-topmost', 1) | |
self.root.withdraw() | |
def info(self, msg): | |
self.msgbox.showinfo("来自ladyrick的提示", msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstring> | |
#include <iomanip> | |
#include <iostream> | |
using namespace std; | |
class Base1 { | |
public: | |
virtual void f() { cout << "Base1::f" << endl; } | |
virtual void g() { cout << "Base1::g" << endl; } | |
virtual void h() { cout << "Base1::h" << endl; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<string> split(const string &str, const string &c) { | |
int start = 0; | |
int npos = str.find(c, start); | |
vector<string> result; | |
while (start < str.length() && npos != str.npos) { | |
result.push_back(str.substr(start, npos - start)); | |
start = npos + c.length(); | |
npos = str.find(c, start); | |
} | |
result.push_back(str.substr(start, str.length() - start)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int NumberOf1Between1AndN_Solution(int n) | |
{ | |
int ones = 0; | |
for (long long m = 1; m <= n; m *= 10) | |
ones += (n / m + 8) / 10 * m + (n / m % 10 == 1) * (n % m + 1); | |
return ones; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS1='\[\033[35;1m\]\w\[\033[36;1m\] > \[\033[00m\]' | |
alias ls="ls --color=auto" | |
alias ll="ls -alhF" | |
alias la="ls -a" | |
alias l="ll" | |
alias ..="cd .." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <sstream> | |
#include <bitset> | |
#include <typeinfo> | |
using namespace std; | |
class cast2bits { | |
private: |
NewerOlder