Skip to content

Instantly share code, notes, and snippets.

View SirSaleh's full-sized avatar
😋
چی بگم والو:

Saleh SirSaleh

😋
چی بگم والو:
  • Nowhere
View GitHub Profile
@SirSaleh
SirSaleh / auto_water_mark_a_dir.py
Last active July 30, 2019 10:36
Watermark a directory photos automatically using python and PIL (tested on python3)
import os
from PIL import Image
def set_watermark(photo, watermark):
photo_size = photo.size
watermark_size = watermark.size
print(watermark_size)
location = (0, int(photo_size[1]/1.3))
b = int(photo_size[1] / 10)
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active June 26, 2024 07:20
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@subfuzion
subfuzion / curl.md
Last active June 22, 2024 13:47
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@meysampg
meysampg / gist:ed3044a076cd5808e50b
Created March 12, 2015 17:10
Simple OOP for Saleh
class Human:
age = 0
name = '';
def __init__(self, name, age):
self.name = name
self.age = age
def setAge(self, age):
self.age = age
@louisbl
louisbl / LocationFragment.java
Last active September 28, 2021 20:53
Fragment for Location Manager
package;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
@cansadadeserfeliz
cansadadeserfeliz / views.py
Last active March 24, 2020 00:55
Django (extreme case): How to raise form invalid inside form_valid method of a FormView (CreateView/UpdateView) and add an error message to not field errors
from django.forms.util import ErrorList
from django import forms
class ContractUpdateView(UpdateView):
model = Contract
template_name = 'contract/contract_form.html'
form_class = ContractForm
def form_valid(self, form):
if self.request.POST.get('finish'):