Skip to content

Instantly share code, notes, and snippets.

View mortymacs's full-sized avatar

Morteza NourelahiAlamdari mortymacs

View GitHub Profile
@mortymacs
mortymacs / A.markdown
Last active September 14, 2017 02:59 — forked from umpirsky/A.markdown
Sublime Text Monokai Sidebar Theme.
@mortymacs
mortymacs / set_dark_theme.py
Last active July 9, 2017 19:06 — forked from sergejx/gist:2358089
Set dark theme for GTK+ application
from gi.repository import Gtk
settings = Gtk.Settings.get_default()
settings.set_property("gtk-application-prefer-dark-theme", True)
@mortymacs
mortymacs / tmux-notify.pl
Created July 16, 2017 06:42 — forked from basilfx/tmux-notify.pl
Irssi and tmux-notify
use strict;
use warnings;
use vars qw($VERSION %IRSSI);
use Irssi;
# Script info
$VERSION = '0.1';
%IRSSI = (
authors => 'Bas Stottelaar',
@mortymacs
mortymacs / signals.creole
Last active July 22, 2017 05:57 — forked from synther/gist:d376100a8bae896d0caf
linux signals cheat sheet
Signal Value Action Comment
SIGHUP 1 Term Hangup detected on controlling terminal or death of controlling process
SIGINT 2 Term Interrupt from keyboard
SIGQUIT 3 Core Quit from keyboard
SIGILL 4 Core Illegal Instruction
SIGABRT 6 Core Abort signal from abort(3)
SIGFPE 8 Core Floating point exception
SIGKILL 9 Term Kill signal
SIGSEGV 11 Core Invalid memory reference
SIGPIPE 13 Term Broken pipe: write to pipe with no readers
@mortymacs
mortymacs / config.yml
Created July 18, 2017 17:37
Parse YAML from bash with sed and awk.
development:
adapter: mysql2
encoding: utf8
database: my_database
username: root
password:
apt:
- somepackage
- anotherpackage
@mortymacs
mortymacs / http_get.go
Created July 29, 2017 10:30 — forked from ijt/http_get.go
Example of using http.Get in go (golang)
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
@mortymacs
mortymacs / radixsort.py
Created August 25, 2017 13:18 — forked from mre/radixsort.py
Radix Sort implementation in Python
from math import log10
from random import randint
def get_digit(number, base, pos):
return (number // base ** pos) % base
def prefix_sum(array):
for i in range(1, len(array)):
array[i] = array[i] + array[i-1]
return array
@mortymacs
mortymacs / avl_tree.py
Created September 1, 2017 07:56 — forked from girish3/avl_tree.py
AVL tree implementation in python
#import random, math
outputdebug = False
def debug(msg):
if outputdebug:
print msg
class Node():
def __init__(self, key):
@mortymacs
mortymacs / memcached_cheat.sh
Created September 27, 2017 07:48 — forked from chibicco/memcached_cheat.sh
memcached Cheat Sheet, One-liner.
#!/bin/bash
exit 1
# get item list
echo -e 'stats items \n quit' | curl -s -T - telnet://localhost:11211
# get by key
echo -e 'get keyname \n quit' | curl -s -T - telnet://localhost:11211
@mortymacs
mortymacs / openvpn-conf.md
Last active November 21, 2017 11:47 — forked from narbehaj/create-client.sh
OpenVPN Server Configuration for GNU/Linux Servers

OpenVPN Config

apt-get install openvpn easy-rsa
mkdir /etc/openvpn/easy-rsa
cp -rf /usr/share/easy-rsa/* /etc/openvpn/easy-rsa
cp /etc/openvpn/easy-rsa/openssl-1.0.0.cnf /etc/openvpn/easy-rsa/openssl.cnf

Edit the vars file in order to create certificates information: