Skip to content

Instantly share code, notes, and snippets.

@fifiteen82726
fifiteen82726 / centos6.10-python3.dockerfile
Last active June 5, 2019 20:33
Install Python3.4 and pip3 on Centos6.10 with Dockerfile
FROM centos:6.7
RUN yum -y update && \
yum -y localinstall --nogpgcheck http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm && \
yum install -y ksh libXp libXmu libXScrnSaver && \
yum install -y openssh-server openssh-clients && \
yum install -y fuse-sshfs tcsh libpng-devel libjpeg libXft libGLU python-pip && \
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel xz-libs wget vim
# Install python3.4 and pip3
RUN yum -y --disablerepo="*" --enablerepo="epel" install python34 && \
curl -O https://bootstrap.pypa.io/get-pip.py && \
pragma solidity ^0.4.17;
contract ArrayOverflow{
uint256 public target = 100;
uint256[] public array = [9,8];
// _ means local variable
function modifyArray (uint256 _index, uint256 _value){
array[_index] = _value;
}
pragma solidity ^0.4.17;
contract ArrayOverflow{
uint256 public target = 100;
uint256[] public array = [9,8];
bytes32 hashValue;
// constructor
// _ means local variable
function modifyArray (uint256 _index, uint256 _value){
contract StorageTest {
uint256 a; // slot 0
uint256[2] b; // slots 1-2
struct Entry {
uint256 id;
uint256 value;
}
Entry c; // slots 3-4
Entry[] d;
contract StorageTest {
uint256 a;
uint256[2] b;
struct Entry {
uint256 id;
uint256 value;
}
Entry c;
}
import matplotlib.pyplot as plt
import numpy as np
origin_image = [
[70, 70, 100, 70, 87, 87, 150, 187],
[85, 100, 96, 79, 87, 154, 87, 113],
[100, 85, 116, 79, 70, 87, 86, 196],
[136, 69, 87, 200, 79, 71, 117, 96],
[161, 70, 87, 200, 103, 71, 96, 113],
[161, 123, 147, 133, 113, 113, 85, 161],
import matplotlib.pyplot as plt
import numpy as np
origin_image = [
[70, 70, 100, 70, 87, 87, 150, 187],
[85, 100, 96, 79, 87, 154, 87, 113],
[100, 85, 116, 79, 70, 87, 86, 196],
[136, 69, 87, 200, 103, 71, 96, 113],
[161, 70, 87, 200, 113, 113, 85, 161],
[161, 123, 147, 133, 113, 113, 85, 161],
class Solution(object):
def sortColors(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
self.helper(nums, 0, len(nums) -1)
def helper(self, nums, left, right):
if len(nums) <= 1: return
Attaching to pubsub_1_app_1, pubsub_1_db_1, pubsub_1_redis_1
app_1 | A server is already running. Check /pubsub_1/tmp/pids/server.pid.
app_1 | => Booting Puma
app_1 | => Rails 5.1.6 application starting in development
app_1 | => Run `rails server -h` for more startup options
app_1 | Exiting
app_1 | => Booting Puma
app_1 | => Rails 5.1.6 application starting in development
app_1 | => Run `rails server -h` for more startup options
app_1 | Puma starting in single mode...
@fifiteen82726
fifiteen82726 / block.rb
Created March 5, 2018 03:51
medium: Block example
require 'openssl'
class Block < ApplicationRecord
belongs_to :block_chain, optional: true
def explain
p '==== Block ==== '
p "Timestamp: #{created_at}"
p "last_hash: #{last_hash}"
p "hash_value: #{hash_value}"