Skip to content

Instantly share code, notes, and snippets.

View qiwihui's full-sized avatar
🦉
Focusing

qiwihui qiwihui

🦉
Focusing
View GitHub Profile
@qiwihui
qiwihui / cx_oracle.md
Created March 19, 2018 08:28 — forked from kimus/cx_oracle.md
Installing python cx_oracle on Ubuntu

First of all, it just seems like doing anything with Oracle is obnoxiously painful for no good reason. It's the nature of the beast I suppose. cx_oracle is a python module that allows you to connect to an Oracle Database and issue queries, inserts, updates..usual jazz.

Linux

Step 1:

sudo apt-get install build-essential unzip python-dev libaio-dev

Step 2. Click here to download the appropriate zip files required for this. You'll need:

@qiwihui
qiwihui / Hexo_Moduleversionmismatch.md
Last active May 14, 2018 07:38
Hexo: Module version mismatch

I was also getting this but with the error:

[Error: Module version mismatch. Expected 46, got 47.]

It seems there was a mismatch between one of:

The hexo in node_modules/.bin The hexo in /usr/local/bin/hexo

@qiwihui
qiwihui / .travis.yml
Created October 31, 2018 07:57 — forked from willprice/.travis.yml
How to set up TravisCI for projects that push back to github
# Ruby is our language as asciidoctor is a ruby gem.
lang: ruby
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
@qiwihui
qiwihui / pandoc.md
Created February 26, 2019 05:29
pandoc cheat sheet

Convert makrdown to reStructuredText

pandoc --from=markdown --to=rst --output=README.rst README.md
@qiwihui
qiwihui / hwtemp.md
Created June 21, 2019 02:12
monitoring cpu temperature
$ sudo apt-get install lm-sensors
$ sudo sensors-detect
$ sensors

iwlwifi-virtual-0
Adapter: Virtual device
temp1:        +57.0°C

acpitz-virtual-0
'''Train a simple deep NN on the MNIST dataset.
Get to 98.40% test accuracy after 20 epochs
(there is *a lot* of margin for parameter tuning).
2 seconds per epoch on a K520 GPU.
'''
import numpy as np
np.random.seed(1337) # for reproducibility
from functools import partial
from keras.datasets import mnist
@qiwihui
qiwihui / Ballot.sol
Last active April 24, 2022 07:44
Ballot with 5 minutes limited.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/// @title Voting with delegation.
contract Ballot {
// This declares a new complex type which will
// be used for variables later.
// It will represent a single voter.
struct Voter {
uint weight; // weight is accumulated by delegation
bool voted; // if true, that person already voted
@qiwihui
qiwihui / HelloWorld.sol
Created April 25, 2022 02:40
HelloWorld.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract HellowWorld {
uint256 number;
function storeNumber(uint256 num) public {
number = num;
@qiwihui
qiwihui / escrow.move
Created August 3, 2022 03:46
Escrow.move
/// @title Escrow
/// @dev Basic escrow module: holds an object designated for a recipient until the sender approves withdrawal.
module SFC::Escrow {
use StarcoinFramework::Signer;
use StarcoinFramework::Option::{Self, Option};
struct Escrow<T: key + store> has key {
recipient: address,
obj: Option<T>
}
@qiwihui
qiwihui / a
Created November 20, 2022 13:39
data:application/json;base64,eyJuYW1lIjogIlNoZWVwICMxIiwgImRlc2NyaXB0aW9uIjogIlRob3VzYW5kcyBvZiBTaGVlcCBhbmQgV29sdmVzIGNvbXBldGUgb24gYSBmYXJtIGluIHRoZSBtZXRhdmVyc2UuIEEgdGVtcHRpbmcgcHJpemUgb2YgJFdPT0wgYXdhaXRzLCB3aXRoIGRlYWRseSBoaWdoIHN0YWtlcy4gQWxsIHRoZSBtZXRhZGF0YSBhbmQgaW1hZ2VzIGFyZSBnZW5lcmF0ZWQgYW5kIHN0b3JlZCAxMDAlIG9uLWNoYWluLiBObyBJUEZTLiBOTyBBUEkuIEp1c3QgdGhlIEV0aGVyZXVtIGJsb2NrY2hhaW4uIiwgImltYWdlIjogImRhdGE6aW1hZ2Uvc3ZnK3htbDtiYXNlNjQsUEhOMlp5QnBaRDBpZDI5dmJHWWlJSGRwWkhSb1BTSXhNREFsSWlCb1pXbG5hSFE5SWpFd01DVWlJSFpsY25OcGIyNDlJakV1TVNJZ2RtbGxkMEp2ZUQwaU1DQXdJRFF3SURRd0lpQjRiV3h1Y3owaWFIUjBjRG92TDNkM2R5NTNNeTV2Y21jdk1qQX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