Skip to content

Instantly share code, notes, and snippets.

View kavehmz's full-sized avatar

Kaveh Mousavi Zamani kavehmz

  • Berlin
View GitHub Profile
$i=0;
while (<>) {
$i++;
print "\n$i\n";
$ip=$_;
chomp $ip;
$s = 'curl -X POST "https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules" -H "X-Auth-Email: sysadmin@regentmarkets.com" -H "X-Auth-Key: XVXCVXCVXCVXCVXCVXCVXCVCXVXC" -H "Content-Type: application/json" --data \'{"mode":"block","configuration":{"target":"ip","value":"'.$ip.'"},"notes":"2015-08-01 DDOS"}\'';
print $s;
eval `$s`;
}

All emails in QA machines are redircred to nobody@localhost

All email for nobody@localhost is stored in /tmp/default.mailbox

reading emails

$ mutt -f /tmp/default.mailbox 

checking html format of email

amount
basis
contract_type
currency
date_start
date_expiry
duration
duration_unit
symbol
barrier
entry_spot_epoch
is_path_dependent
ask_probability_news_factor
ask_probability_amount
bid_price
price
is_expired
bid_probability_amount
opposite_contract_commission_markup_amount
commission_markup_amount
symbol
payout
tick_expiry
currency
shortcode
expiry_daily
is_after_settlement
bid_price
is_expired
ask_price
// runqput tries to put g on the local runnable queue.
// If next if false, runqput adds g to the tail of the runnable queue.
// If next is true, runqput puts g in the _p_.runnext slot.
// If the run queue is full, runnext puts g on the global queue.
// Executed only by the owner P.
func runqput(_p_ *p, gp *g, next bool) {
if randomizeScheduler && next && fastrand()%2 == 0 {
next = false
}
@kavehmz
kavehmz / T
Created September 22, 2017 12:35
Adding lock mechanism to GCS remote backend by suing pubsub Topics.
Concept is imilar to how we create/delete lock file to acquirs/release lock.
We are using remote state-file in our team.We need this in our team to be able to work in a safer way. Our team is small but still this simple change can improve out ability to work together.
Code changes is small.
```hcl
terraform {
@kavehmz
kavehmz / init.sh
Last active February 25, 2018 10:38
sudo mount /dev/xvdf /mnt
sudo chown admin /mnt -R
if [ ! -d /mnt/go ]
then
cd /mnt
wget https://dl.google.com/go/go1.10.linux-amd64.tar.gz
tar --gzip -xf go1.10.linux-amd64.tar.gz
mkdir -p gopath
echo 'export GOPATH=/mnt/gopath' >> ~/.bashrc
echo 'export PATH=$PATH:/mnt/go/bin/:$GOPATH/bin' >> ~/.bashrc
heroku logs -a XXXX -n 10000 >> /tmp/logs.heroku
cat /tmp/logs.heroku |cut -d' ' -f 5|cut -d'"' -f 2|perl -e 'while ($a=<>) {chomp $a;$a=~ /event=([a-zA-Z_-]+)/;print "$1,$a\n"}' |sort -u -t, -k1,1 |cut -d, -f2
#!/bin/bash
# Copyright 2015 Google Inc. All rights reserved.
#
# 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