Skip to content

Instantly share code, notes, and snippets.

View pchaozhong's full-sized avatar

hirosaki.tokyo pchaozhong

View GitHub Profile
@WaleedAshraf
WaleedAshraf / cluster-module.js
Last active October 31, 2018 02:50
Switching from cluster module to PM2 & RabbitMQ
var cluster = require('cluster');
const numCPUs = require('os').cpus().length;
module.exports.create = function(options, callback){
if (cluster.isMaster) {
// fork child process for notif/sms/email worker
global.smsWorker = require('child_process').fork('./smsWorker');
global.emailWorker = require('child_process').fork('./emailWorker');
global.notifiWorker = require('child_process').fork('./notifWorker');
@raineorshine
raineorshine / sendRawTransaction.js
Last active December 3, 2022 18:02
Sends a raw transaction with web3 v1.2.2, ethereumjs-tx v2.1.1, and Infura
const Web3 = require('web3')
const Tx = require('ethereumjs-tx').Transaction
// connect to Infura node
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/INFURA_KEY'))
// the address that will send the test transaction
const addressFrom = '0x1889EF49cDBaad420EB4D6f04066CA4093088Bbd'
const privateKey = new Buffer('PRIVATE_KEY', 'hex')
@maheshmurthy
maheshmurthy / index.html
Last active December 7, 2021 21:07
Html file to cast and display votes
<!DOCTYPE html>
<html>
<head>
<title>Hello World DApp</title>
<link href='https://fonts.googleapis.com/css?family=Open Sans:400,700' rel='stylesheet' type='text/css'>
<link href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' rel='stylesheet' type='text/css'>
</head>
<body class="container">
<h1>A Simple Hello World Voting Application</h1>
<div class="table-responsive">
@gordthompson
gordthompson / ComExampleUcanaccessDynamicLinkMain.java
Last active May 31, 2022 21:13
dynamically create "linking database" to have UCanAccess only load selected tables
/*
* Copyright 2017 Gordon D. Thompson
*
* 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
@kayo-tozaki
kayo-tozaki / Vagrantfile
Last active May 16, 2019 09:48
vagrantfile for ubuntu-gui
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# ↓yes proxy statement / not set using NAT only
config.proxy.http = "http://your.proxy.address:port_num"
config.proxy.https = "https://your.proxy.address:port_num"
# ↓no proxy statement
#config.proxy.http = ""
@tjade273
tjade273 / Database.sol
Last active April 6, 2024 04:32
Example of separated storage and logic
contract Database{
mapping(uint => uint) public _data;
mapping(address => bool) _owners;
function Database(address[] owners){ //Called once at creation, pass in initial owners
for(uint i; i<owners.length; i++){
_owners[owners[i]]=true;
}
}
@soheilhy
soheilhy / nginxproxy.md
Last active July 5, 2025 15:29
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'faraday'
require 'json'
require 'date'
module HealthCare
class Client
def initialize
2013/7/28 VpnFaker-V21.zipのアドレスを更新。
2013/5/27 「11. LSMの解除」の解除コマンド名が間違っていたため訂正。
2013/5/27 「7. 再起動を行う」のプロンプトを訂正。
2013/5/24 「6. VpnFakerをインストールする」の手順に抜けがあったため追記。
VpnFaker.apkを/data/appにコピーするコマンドが抜けていた。
2013/5/20 root権限の取得について補足
@fi01
fi01 / ptrace_test.c
Created November 16, 2013 14:54
CVE-2013-6282 exploit SH-06E ビルド01.00.07のMIYABI解除済みの環境で/sys/kernel/uevent_helperに"test_data"を書き込む。 下記のコードを流用した。 https://android.googlesource.com/platform/cts/ branch android-4.4_r1.1 ./tests/tests/security/jni/android_security_cts_NativeCodeTest.cpp
/*
* Copyright (C) 2013 The Android Open Source Project
*
* 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