Skip to content

Instantly share code, notes, and snippets.

View jeka-kiselyov's full-sized avatar

Jeka Kiselyov jeka-kiselyov

View GitHub Profile
@jeka-kiselyov
jeka-kiselyov / SuiMove.sh
Last active March 4, 2024 23:09
Sui Move Dev On Linux Cheatsheet
# Local Sui network
# Docs: https://docs.sui.io/build/sui-local-network
# Upgrade local:
cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui
# Install local validator:
sudo apt-get install libpq-dev
cargo install --locked --git https://github.com/MystenLabs/sui.git --branch main sui-test-validator
#
# run local Sui development test validator node
@jeka-kiselyov
jeka-kiselyov / setupmongo.sh
Last active August 11, 2021 10:50
Install and setup mongodb server on AWS Ubuntu 18.04 EC2 Instance
#!/bin/bash
#Makes it public and set up authentication
echo "Installing repo"
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
echo "Installing binaries"
sudo apt-get update
@jeka-kiselyov
jeka-kiselyov / ainstall.sh
Last active August 16, 2018 04:17
Haproxy 1.6 node server balancer on Ubuntu, works on aws
sudo add-apt-repository ppa:vbernat/haproxy-1.6
sudo apt-get update
sudo apt-get install haproxy
# restart service
sudo service haproxy restart
# configuration file
sudo nano /etc/haproxy/haproxy.cfg
@jeka-kiselyov
jeka-kiselyov / index.js
Last active October 4, 2018 09:28
CloudWatch to AWS Lambda to Slack Channel Alerts and Charts. Posts CloudWatch Alerts via SNS topic via Lambda function to Slack channel. And draws charts for CPUUtilization metrics(both for EC2 abd RDS).
////// Save as index.js and upload it to Lambda as zip archive with node_modules directory. After:
////// npm install aws-cloudwatch-chart
////// npm install request
////// no need to upload aws-sdk module
////// Don't forget to change API keys here.
////// License: MIT
////// Docs:
@jeka-kiselyov
jeka-kiselyov / backup.php
Last active August 16, 2018 04:18
Backup wordpress installation and blog database to pbworks workspace
<?php
//// usage - php backup.php domain
$network = 'network';
$workspace = 'workspace';
$apikey = '...........';
$tmp_path = sys_get_temp_dir(); //// should be writable
define( 'ABSPATH', dirname(__FILE__) . '/' );
//// create empty wp-settings.php file (wp config tries to find it)
@jeka-kiselyov
jeka-kiselyov / add_apache_domain.sh
Last active August 29, 2015 14:20
SH to add apache domain to dynamic virtual hosts
#!/bin/bash
run()
{
echo "Adding new apache domain"
if [ "$(id -u)" != "0" ]; then
echo "Sorry, but this script should be executed by root only. Try: sudo ./add_apache_domain.sh"
return
fi
@jeka-kiselyov
jeka-kiselyov / apache2.conf
Last active August 29, 2015 14:05
Apache apache2.conf for localhost
SetEnv localhost localhost
ServerName localhost
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
@jeka-kiselyov
jeka-kiselyov / vklike.js
Created April 28, 2014 17:17
Do like avatars of every vk user on search page
var l = document.getElementsByClassName('img'); for (var k in l) if (typeof(l[k].onmouseover) == 'function') l[k].onmouseover();
var els = document.getElementsByClassName('search_bigph');
var cur_els = 0;
setTimeout(next_cur_el, 5000);
function next_cur_el()
{
if (typeof(els[cur_els]) == 'undefined') return;
els[cur_els].click();
var r1 = Math.random() * (3000 - 500) + 500;
var r2 = Math.random() * (5000 - 2000) + 2000 + r1;
@jeka-kiselyov
jeka-kiselyov / update.sh
Created March 5, 2014 16:05
Update.sh for dreamhost
#!/bin/sh
echo "Updating devtest area";
echo "Enter your git credentials below:";
cd ~/domain/
git pull
cd ../
/usr/local/php53/bin/php ~/domain/www/cli/tools/update_schema.php
@jeka-kiselyov
jeka-kiselyov / backup_to_pbworks.php
Last active August 29, 2015 13:56
Back up folders and mysql databases on pbworks workspace
<?php
////
//// Usage: php backup_to_pbworks.php network workspace apikey
////
//// Archives uploads folder and mysql database and saves it in pbworks workspace
////
require "includes/cron_init.php"; //// You can change this to any init you want.
/// Basically we need only __db_database__, __db_host__ etc params from settings/db.php
/// But you can easily use your own values few lines below and remove this require