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
package blockchain | |
import ( | |
"time" | |
"crypto/sha256" | |
"encoding/binary" | |
"bytes" | |
"fmt" | |
) |
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 "stdafx.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <openssl/ssl.h> | |
#include <openssl/err.h> | |
#include <uv.h> | |
#define DEFAULT_PORT 7000 | |
#define DEFAULT_BACKLOG 128 |
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
// Copyright 2018 The gVisor Authors. | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, |
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> // printf | |
#include <string.h> // strerror | |
#include <errno.h> // errno | |
#include <unistd.h> // execl | |
#include <sys/ptrace.h> // ptrace | |
#include <sys/user.h> // user_regs_struct | |
// get from strace sources | |
// cat strace-4.6/linux/x86_64/syscallent.h | sed -e 's/\(".*"\)/=\1/' | sed -e 's/^.*=//' | sed -e 's/"\(.*\)".*$/"\1",/' | |
// |
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
flatten = lambda lst: reduce(lambda l,i: l + flatten(i) if isinstance(i, (list,tuple)) else l + [i], lst, []) | |
print flatten([2, [2, [4, 5, [7], [2, [6, 2, 6, [6], 4]], 6]]]) | |
# -> [2, 2, 4, 5, 7, 2, 6, 2, 6, 6, 4, 6] |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
# -*- coding: utf-8 -*- | |
import socket,sys,time | |
#时间服务器 | |
host = "stdtime.gov.hk" | |
#端口 | |
port = 37 | |
#时区 | |
curtz = 8 | |
#连接服务器,并接收返回 | |
try: |
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
sudo rpi-update | |
sudo apt-get install python-dev | |
sudo easy_install -U distribute | |
sudo apt-get update | |
sudo apt-get install python-setuptools | |
sudo apt-get install rpi.gpio | |
sudo apt-get install python-pip | |
sudo pip install rpi.gpio | |
sudo easy_install pip |
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 socket import * | |
import datetime,os,struct,time,sys | |
# Script to set Linux hardware clock (/usr/sbin/hwclock) from an NTP | |
# time server. Run as "setclock.py" to simply print the time from | |
# the NTP server. Run as "setclock.py --set" to set the Linux | |
# hardware clock (as the super user, of course). | |
# Based on Simon Foster's simple SNTP client from ASPN Python cookbook. | |
# Adapted by Paul Rubin; this script lives at: | |
# http://www.nightsong.com/phr/python/setclock.py |
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
#coding:utf-8 | |
from Tkinter import * | |
import tkSimpleDialog,tkFileDialog,os | |
from ttk import * | |
def ask(): | |
a = tkSimpleDialog.askstring('Beordle','Text from:',initialvalue='') | |
if a==None: | |
return None,None | |
b = tkSimpleDialog.askstring('Beordle','Text to:',initialvalue='') |
NewerOlder