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)
def rev(word):
out = ""
chars = [xx for xx in word]
for char in chars:
out = char + out
return out
if __name__=='__main__':
@SirSaleh
SirSaleh / MVNormPlot.R
Last active September 30, 2021 09:30
plot bivariate normal distribution in R
# need mvtnorm package
library("mvtnorm")
range = seq(-5,5,0.1)
mean = c(0,0)
Sigma = matrix(c(1, .5, .5, 1), 2)
out = matrix (rep(0,101*101),101)
for (i in 1:length(range)){
for (j in 1:length(range)){
out[i,j] = dmvnorm(c(range[i],range[j]),mean=mean,sigma=Sigma)
@SirSaleh
SirSaleh / flmultilinealignexample.tex
Created October 14, 2016 13:45
for blug post about flalign
\begin{flalign*}
(\lambda+\gamma)^2 &= (a + b)^2&\\
&= a^2 + b^2 + ab&\\
&= a^2 + c^2&
\end{flalign*}
\begin{flalign*}
\lambda^2 &= (a + b)^2 &
\end{flalign*}
@SirSaleh
SirSaleh / amsload.tex
Created October 14, 2016 09:49
forblog
\usepackage{amsmath}
@SirSaleh
SirSaleh / gist:11944d5bd45931abb99a
Last active September 18, 2015 06:52
monte carlo pi estimate for weblog
MCEstimator <- function(n = 10000){
#circ counts number of samples which are in the circle!
circ=0
for (i in c(1:n)){
x=runif(1,-1,1)
@SirSaleh
SirSaleh / interchange.c
Created March 27, 2015 15:09
A code for Dear Sachida Barik To Exchange two word in a text file
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
//count_data();
void main()
{
// calling function
count_data();