Skip to content

Instantly share code, notes, and snippets.

View muayyad-alsadi's full-sized avatar

Muayyad Alsadi muayyad-alsadi

View GitHub Profile
@muayyad-alsadi
muayyad-alsadi / ssh-multi.sh
Last active October 29, 2015 12:12 — forked from dmytro/ssh-multi.sh
Start multiple synchronized SSH connections with Tmux
#!/bin/bash
# ssh-multi.sh - a script to ssh multiple servers over multiple tmux panes
# usage: type tmux then from inside tmux type ssh-multi.sh HOST1 HOST2 ... HOSTN
# Muayyad Alsadi, D.Kovalov
# https://gist.github.com/muayyad-alsadi/bd25845776bb6b4185ba/
# https://gist.github.com/dmytro/3984680
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
function error() {
@muayyad-alsadi
muayyad-alsadi / fake-runtime.spec
Created August 25, 2015 13:14
fake-runtime.spec
Name: fake-runtime
Version: 0.0.1
Release: 1%{?dist}
Summary: Fake runtime
License: GPLv2+
BuildArch: noarch
Provides: kmod
Provides: systemd = 204
Provides: systemd-sysv = 204
Provides: systemd-units = 204
@muayyad-alsadi
muayyad-alsadi / index.html
Created August 21, 2015 22:37
golang-web-demo
<html>
<head>
<title>{{.Title}}</title>
</head>
<body>
<h1>{{.Title}}</h1>
</body>
</html>
@muayyad-alsadi
muayyad-alsadi / django-dev-howto.txt
Last active September 2, 2015 13:14
how to setup your development environment for python/django
# as root
yum install python-pip python-pillow python-lxml python-psutil python-simplejson python-ldap python-crypto python-pwquality PyYAML MySQL-python python-psycopg2 libxslt-python python-greenlet python-gevent python-gevent-socketio python-gevent-websocket
pip install --upgrade pip
pip install wheel virtualenv
##################
# as usual user
###################
# install to common ~/wheels to save downloads
.pull-start {float:right;}
.pull-end {float:left;}
.text-start {text-align:right;}
.text-end {text-align:left;}
.media > .pull-start {margin-left: 10px;}
.media > .pull-end {margin-right: 10px;}
.carousel-control.prev { right: 15px; left: auto; }
.carousel-control.next { left: 15px; right: auto; }
magin-left: 500px;
becomes:
margin-left: auto;
margin-right: 500px
while
@muayyad-alsadi
muayyad-alsadi / primes.c
Last active August 29, 2015 14:03
primes in C/C++
#include <stdlib.h>
#include <alloca.h>
#include <stdio.h>
#include <sys/time.h>
int* get_primes(int n, int *l) {
char* compo=(char*)alloca(n);
int* primes=(int*)malloc(sizeof(int)*n);
int i,j,c=0;
for(i=0;i<n;++i) compo[i]=0;
@muayyad-alsadi
muayyad-alsadi / primes.py
Created July 5, 2014 18:30
primes optimizations
import time
def get_primes(n):
primes=[]
compo=set()
in_compo=compo.__contains__
add_prime=primes.append
add_compo=compo.update
for i in range(2, n):
if in_compo(i): continue
@muayyad-alsadi
muayyad-alsadi / primes2.lua
Created July 5, 2014 15:43
primes as linked list in lua
function get_primes (n)
compo={}
primes={n=nil, v=nil}
last=primes
for i=2,n do
if not compo[i] then
last.v=i
last.n={n=nil, n=nil}
last=last.n
for j=i*2,n,i do
@muayyad-alsadi
muayyad-alsadi / primes.lua
Last active August 29, 2015 14:03
primes in lua
function get_primes (n)
compo={}
primes={}
for i=2,n do
if not compo[i] then
primes[i]=true
for j=i*2,n,i do
compo[j]=true
end
end