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<stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
/* 大多数编译器默认对有符号数的右移采用算数右移 */ | |
int a = -32; | |
int result = a >> 1; | |
printf("The result is %d\n", result); |
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
window.onload = function () { | |
var canvas = document.getElementById('canvas'); | |
canvas.width = 1024; | |
canvas.height = 768; | |
if(canvas.getContext("2d") ) { | |
var context = canvas.getContext('2d'); | |
// 使用context绘制 |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import os | |
LOG_BASE_NAME = 'snmp_info.log' | |
INDEX = 0 | |
while True: |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
def solve(eq,var='x'): | |
"""利用Python来解一元方程。 | |
代码来源:https://python-china.org/t/1152# | |
程序的思路就是把x当做了复数的虚部,然后利用虚部运算出x的系数 | |
剩下的实数就是复数的实部,然后实部除以虚部,就得出x的解了。 |
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
#!/bin/bash | |
#History: | |
# Michael Sep,09,2016 | |
#Program: | |
# | |
INTERVAl=5 | |
PREFIX=$INTERVAl-sec-status | |
RUNFILE="/tmp/mysql-test-running" | |
mysql -e 'SHOW GLOBAL VARIABLES' -u root -pdeepin >> mysql-variables |
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
sendfile on; | |
tcp_nopush on; | |
#keepalive_timeout 0; | |
keepalive_timeout 65; | |
#gzip on; | |
server { | |
listen 8082; #端口 |
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
[global] | |
workgroup = WORKGROUP | |
server string = Samba Server %v | |
netbios name = ubuntu | |
security = user | |
map to guest = bad user | |
dns proxy = no | |
[Anonymous] | |
path = /tmp |
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
function pet(words) { | |
this.words = words; | |
console.log(this.words); | |
console.log(this === global); // true | |
} | |
pet('...'); | |
function Pet(words) { |
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
// call函数的作用就是改变某个函数执行时的上下文(this),变成一个指定的变量。 | |
function Pet(words) { | |
this.words = words; | |
this.speak = function() { | |
console.log('say' + ' ' + this.words); | |
} | |
} |
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
var http = require('http'); | |
var cheerio = require('cheerio'); | |
var url = 'http://www.imooc.com/learn/348'; | |
var assert = require('assert'); | |
function deleteBlank(string) { | |
results = [] | |
lines = string.split('\r\n'); | |
lines.forEach(function (line) { | |
if(! /^\s*$/.test(line)) { |
OlderNewer