Skip to content

Instantly share code, notes, and snippets.

View bliz937's full-sized avatar

Vyacheslav Shevchenko bliz937

View GitHub Profile
@bliz937
bliz937 / hadoop-setup.sh
Last active November 29, 2016 14:23
A script that I used to setup hadoop.
#!/bin/bash
# Hadoop http download location
hadoop_http="https://archive.apache.org/dist/hadoop/core/hadoop-2.7.2/hadoop-2.7.2.tar.gz"
# Location to install hadoop
HADOOP_INSTALL=/opt/hadoop/
# User to run hadoop under
HADOOP_USER=hadoop
#!/bin/bash
UN_MOUNT="/dev/sdb"
IMAGE="/home/home/image.img"
while [ 1 ]; do
umount $(UN_MOUNT)*
if [ $? -eq 0 ]; then
dd if=$(IMAGE) of=$(UN_MOUNT)
@bliz937
bliz937 / VM-restore.sh
Created July 11, 2016 17:06
XenServer VM snapshot restore script that worked for me.
#!/bin/bash
#Direcotry of backup VMs
VMS_DIR="/mnt/20160711/"
########################
GUNZIP="/usr/bin/gunzip"
PRINTF="/usr/bin/printf"
XE="/opt/xensource/bin/xe"
@bliz937
bliz937 / contiki-install.sh
Last active July 2, 2016 16:52
Testing contiki install script.
#!/bin/bash
function repo {
printf "Installing repo...\n"
sudo echo "deb http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu trusty main" > /etc/apt/sources.list.d/gcc-arm-embedded.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key FE324A81C208C89497EFC6246D1D8367A3421AFB
sudo apt-get update
printf "\nRepo installed\n"
}
"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '%s'"
If your query has one value that you're passing through, say, idVal, then add a comma in the tupple.
Ex
cursor.execute(query, (idVal,))
@bliz937
bliz937 / exp.pl
Created February 25, 2016 20:53
My first attempt at perl. e^x
#!/usr/bin/perl -w
use strict;
use warnings;
sub calc {
my $total = 1;
my $ans = 10.0;
my $x = $_[0];
my $fac = 1.0;
@bliz937
bliz937 / Asus Z170M-Plus Raid
Created February 1, 2016 11:41
Making a raid drive bootable - Asus Z170M-Plus
We were having problems having the raid drive show up in the boot options.
Here are the steps we took to change that.
Change at your own risk.
Credit: www.fofx.co.za
===========================================================================
In the BIOS, select advance.
Boot -> Interrupt 19 Capture : Enabled
@bliz937
bliz937 / soln.md
Last active November 17, 2015 19:32
Telegram bot forwarding message error

A bot that I was working on needed to forward messages. Following Telegram's api to forward a message, my code looked like this

botSendFunctions.forwardMessage(bot, chat_id, "@bliz937", update.message.message_id)

I would receive the following error: TelegramError: [Error]: Bad Request: channel not found

@bliz937
bliz937 / ncurses lib error.md
Last active October 27, 2015 18:25
Fix for error while loading shared libraries: libncursesw.so.5: cannot open shared object file: No such file or directory

I manually updated ncurses without all the other packages. When running bash or ldd, I received

bash: error while loading shared libraries: libncursesw.so.5: cannot open shared object file: No such file or directory

My fix was

ln -s /usr/lib/libncursesw.so.6 /usr/lib/libncursesw.so.5
#import socket module
from socket import *
serverSocket = socket(AF_INET, SOCK_STREAM)
#Prepare a sever socket
#Fill in start
#Fill in end
while True:
#Establish the connection
print 'Ready to serve...'
connectionSocket, addr = #Fill in start #Fill in end