Skip to content

Instantly share code, notes, and snippets.

View mostafabahri's full-sized avatar
👨‍💻

Mostafa Bahri mostafabahri

👨‍💻
  • Germany
View GitHub Profile
@mostafabahri
mostafabahri / vpn.sh
Created October 23, 2016 07:57
Let the VPN stay connected.
#!/bin/bash
# don't forget to make it executable : chmod u+x vpn.sh
# run it : ./vpn.sh $vpnName
if [ -z ${1} ]
then
echo "No VPN name given.";
exit 1;
fi
while [[ true ]]; do
@mostafabahri
mostafabahri / index.html
Last active March 9, 2017 13:01
Semantic Todo - Vue.js
<div class="ui container top">
<div class="ui raised pink segment center aligned">
<h1 class="ui header">TodoList - Semantic UI + Vue.js</h1>
</div>
<div class="ui divider"></div>
<div class="uialigned two column grid centered stackable" id="app">
<div class="row">
<div class=" column">
<div class="ui segments">
<div class="ui segment" v-for="(todo,index) in todos"> {{todo.name}} <i class="remove icon large" @click="removeTodo(index)"></i></div>
[core]
autocrlf = input
editor =vim
[alias]
st = status
ld = "log --decorate --oneline"
ld5 = "log --decorate --oneline -n 5"
ll = "log --relative-date --decorate --graph --stat --abbrev-commit"
lla = "log --relative-date --decorate --graph --stat --abbrev-commit --all"
@mostafabahri
mostafabahri / RTL_text_on_image.py
Last active December 16, 2017 08:23
Snippet for writing Persian or other RTL langs on image with Python PIL
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
import PIL
from PIL import ImageFont, Image, ImageDraw
from bidi.algorithm import get_display
import arabic_reshaper
def rtl_fix(text):
@mostafabahri
mostafabahri / python-fabric-deps.sh
Last active December 16, 2017 08:11
Required dependencies for Python Cryptography and/or Fabric.
apt-get install build-essential python3-dev python-dev libssl-dev libffi-dev
@mostafabahri
mostafabahri / container.sh
Last active December 16, 2017 08:09
Docker Tips
# remove all stopped containers!
docker container prune
@mostafabahri
mostafabahri / img_src.regex
Created March 29, 2017 20:20
Regex tips and tricks
"\.\.\/(.+?)"
"{% static '$1' %}"
@mostafabahri
mostafabahri / countries-flag.py
Last active December 16, 2017 08:42
Django trickery
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.8.0/css/flag-icon.min.css">
{% for agency in agencies %}
<div class="section">
<span class="flag-icon flag-icon-{{ agency.country|lower }}"></span> # here
<div class="info rtl">
<h5>{{ agency.country.name }}</h5>
<h5>{{ agency.agent_name }}</h5>
<h5>{{ agency.email }}</h5>
</div>
pragma solidity ^0.4.11;
contract Purchase {
uint public value;
address public seller;
address public buyer;
enum State { Created, Locked, Refund, Inactive }
// state init??
State public state = State.Created;
@mostafabahri
mostafabahri / GitNotes.sh
Last active December 16, 2017 08:07
Git tips and tricks
# display all commits that are in develop but not in master
git log master..develop
# remove file from git tracking
git rm --cached main.py