Skip to content

Instantly share code, notes, and snippets.

modifier postCondition() {
_;
require(expr);
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwner(address _owner) public onlyOwner {
owner = _owner;
}
@hbbio
hbbio / counter.sol
Created June 28, 2022 07:54
Basic counter in Solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
contract TestCounter {
// public automatically creates the getter
int256 public count = 0;
function increment() public {
count += 1;
}
@hbbio
hbbio / counter.opa
Last active June 28, 2022 08:56
Code snippets for "What it takes to write solid smart contracts"
import stdlib.themes.bootstrap
database int /counter = 0;
function action(_) {
/counter++;
#msg = <div>Thank you, user {/counter}!</div>
}
function page() {
<span id="msg">Welcome</span>
import * as Peps from "../Peps"
let sdk = new Peps.SDK("https://awsapi.wpeps.com", "wss://awsws.wpeps.com")
let clear: Uint8Array
// Alice shares a resource with bob
sdk.login("alice", "password").then(function (session) {
return session.ResourceAPI.create(["alice", "bob"], "my/resource", clear)
}).then(function({id, content}){
@hbbio
hbbio / sample.aws
Created June 1, 2017 11:11
Sample awless template
myvpc = create vpc cidr=10.0.0.0/24
mysubnet = create subnet cidr=10.0.0.0/25 vpc=$myvpc zone=eu-west-1a
update subnet id=$mysubnet public=true
create keypair name=demo-awless-keypair
create instance subnet=$mysubnet image={instance.image} type={instance.type} keypair=demo-awless-keypair name=demo-ebs count={instance.count}
create volume zone=eu-west-1a size=1
@hbbio
hbbio / awssecgroup.json
Created June 1, 2017 09:58
aws ec2 describe-security-groups --group-name awless-secgroup
{
"SecurityGroups": [
{
"IpPermissionsEgress": [
{
"PrefixListIds": [],
"FromPort": 80,
"IpRanges": [
{
"CidrIp": "0.0.0.0/0"
@hbbio
hbbio / WALLIX_CLA
Last active October 14, 2016 21:00 — forked from CLAassistant/SAP_CLA
Wallix Individual Contributor License Agreement
###Wallix Individual Contributor License Agreement
Thank you for your interest in contributing to open source software projects (“Projects”) made available by Wallix Group or its affiliates (“Wallix”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to Wallix in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact hbinsztok at wallix dot com.
You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.
**Copyright License.** You hereby grant, and agree to grant, to Wallix a non-exclusive, perpe
Losing Post Reach? Is Facebook Still Worth it?
Is Facebook Still Worth It?
If you’re one of the millions of page owners suffering from a less than satisfactory post reach on your fan page, you might be wondering whether Facebook is still worth the effort.
After spending countless hours, money & effort building your following on the social network, it seems none of that matters anymore, for if you want to reach any of your fans you’re going to have to pay.
Even if a page has 10,000 fans a typical post might only reach 200, or less! And it seems the trend is getting worse.
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
# scheme used to connect to this server
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any