Skip to content

Instantly share code, notes, and snippets.

Process: qemu-system-x86_64 [3650]
Path: /usr/local/bin/qemu-system-x86_64
Identifier: qemu-system-x86_64
Version: 0
Code Type: X86-64 (Native)
Parent Process: zsh [3013]
Responsible: qemu-system-x86_64 [3650]
User ID: 501
Date/Time: 2018-12-18 23:15:28.659 +1100
@rezamt
rezamt / gcloud-fiters.sh
Created December 2, 2018 00:53
GCloud Filter Examples
List all Google Compute Engine instance resources:
$ gcloud compute instances list
List Compute Engine instance resources that have machineType f1-micro:
$ gcloud compute instances list --filter="machineType:f1-micro"
List Compute Engine instance resources with zone prefix us and not
MachineType f1-micro:
@rezamt
rezamt / stack-driver-installer.sh
Created November 28, 2018 11:02
Stack Driver Agent Installation
# To install the Stackdriver monitoring agent:
$ curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh
$ sudo bash install-monitoring-agent.sh
# To install the Stackdriver logging agent:
$ curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh
$ sudo bash install-logging-agent.sh
@rezamt
rezamt / tarsnap_install.sh
Created July 8, 2018 12:40
How to compile tarsnap on your MAC OS
# Install OpenSSL
brew install openssl
# Make sure you add openssl to your shell :
ZSH: echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc
Bash: echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bashrc
# and then export the following environment variables:
export LDFLAGS=-L/usr/local/opt/openssl/lib
@rezamt
rezamt / terraform_proxy.sh
Created July 5, 2018 06:33
By Pass Proxy for Terraform
# The following domains are required to be open in order TF can work.
github.com
login.microsoftonline.com
management.azure.com
# if you are doing go like me, and trying to access azure billing apis, open this one as well.
consumption.azure.com (Billing API)
# Create a backup of master branch
git branch backup_master
# Point master to '56e05fce' and
# make working directory the same with '56e05fce'
git reset --hard 56e05fce
# you can also use the full hash
git reset --hard 56e05fcec80a0aff84cf05ea030c7e478129905
# Point master back to 'backup_master' and
@rezamt
rezamt / resource.go
Created June 30, 2018 17:13
Go Yaml Parser and how to omit empty fields
type Body struct {
FormParameters map[string]NamedParameter `yaml:"formParameters,omitempty"`
Schema string `yaml:"schema,omitempty"`
Example string `yaml:"example,omitempty"`
Headers map[string]NamedParameter `yaml:"headers,omitempty"`
}
type NamedParameter struct {
DisplayName string `yaml:"displayName,omitempty"` // The parameter's display name, used for display or documentation purposes
Description string `yaml:"description,omitempty"` // Describes the intended use or meaning of the parameter
@rezamt
rezamt / packer.json
Created June 29, 2018 06:21
Packager Building Image for Windows - using azure-arm builder
{
"variables": {
"client_id": "{{env `AZURE_CLIENT_ID`}}",
"client_secret": "{{env `AZURE_CLIENT_SECRET`}}",
"subscription_id": "{{env `AZURE_SUBSCRIPTION_ID`}}",
"tenant_id": "{{env `AZURE_TENANT_ID`}}",
"spn_object_id": "{{env `AZURE_SPN_OBJECT_ID`}}",
"resource_group": "{{env `AZURE_BUILD_RESOURCE_GROUP`}}",
"resource_location": "{{env `AZURE_BUILD_LOCATION`}}",
"storage_account": "{{env `AZURE_BUILD_STORAGE_ACCOUNT`}}",
@rezamt
rezamt / MyToken
Created June 28, 2018 13:12
Tonen Basic Smart Contract
pragma solidity ^0.4.20;
contract MyToken {
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
/* Initializes contract with initial supply tokens to the creator of the contract */
function MyToken(
uint256 initialSupply
) public {
@rezamt
rezamt / Incrementer.sol
Created June 28, 2018 12:54
Incrementer Smart Contract
pragma solidity ^0.4.24;
contract Incrementer {
address creator;
uint iteration;
function Incrementer() public
{
creator = msg.sender;