Skip to content

Instantly share code, notes, and snippets.

View pourmand1376's full-sized avatar
😉
Learning

Amir Pourmand pourmand1376

😉
Learning
View GitHub Profile
DECLARE @Name nvarchar(1000);
DECLARE @Sql nvarchar(1000);
DECLARE @Result int;
IF OBJECT_ID('tempdb..#myTable') IS NOT NULL
DROP TABLE #myTable
CREATE TABLE #myTable(
row INT,
query NVARCHAR(500))
@pourmand1376
pourmand1376 / GeneticAlgorithmAI.py
Created January 25, 2020 22:16
Minimizing Math Function with Genetic Algorithm
import math
import random
import numpy
def calculateCost(x,y):
return -0.0001*((
math.fabs(
math.sin(x)*math.sin(y)*math.exp(
math.fabs(
@pourmand1376
pourmand1376 / SimulatedAnnealing.py
Created January 25, 2020 22:17
Minimizing Math Function with Simulated Annealing Algorithm
import math
import random
def calculateCost(x,y):
return -0.0001*((
math.fabs(
math.sin(x)*math.sin(y)*math.exp(
math.fabs(
100 - math.sqrt(x**2+y**2)/math.pi
@pourmand1376
pourmand1376 / fast_fourier_transform_impl.py
Last active May 25, 2021 11:45
Fast Fourier Transform Implementation with numpy
import numpy as np
import matplotlib.pyplot as plt
from skimage import color
def fft(length_x,width_y,v,y,image,inner=True):
expVector=np.exp(-2j*np.pi/width_y*(v@y)) if inner else np.exp(-2j*np.pi/length_x*(v@y))
if inner:
return image @ expVector
else:
return expVector @ image
@pourmand1376
pourmand1376 / github_desktop_ubuntu.sh
Created July 16, 2021 21:52 — forked from berkorbay/github_desktop_ubuntu.md
To install Github Desktop for Ubuntu
#sudo wget https://github.com/shiftkey/desktop/releases/download/release-2.1.0-linux1/GitHubDesktop-linux-2.1.0-linux1.deb
#sudo gdebi GitHubDesktop-linux-2.1.0-linux1.deb
# UPDATE (2021-03-05): Thanks to PaoloRanzi81's comment, the updated code is as follows https://gist.github.com/PaoloRanzi81
sudo wget https://github.com/shiftkey/desktop/releases/download/release-2.6.3-linux1/GitHubDesktop-linux-2.6.3-linux1.deb
### Uncomment below line if you have not installed gdebi-core before
# sudo apt-get install gdebi-core
sudo gdebi GitHubDesktop-linux-2.6.3-linux1.deb
@pourmand1376
pourmand1376 / Data Science CheatSheet.md
Last active August 24, 2021 13:28
Pandas, Numpy, Python Cheatsheet
@pourmand1376
pourmand1376 / After Manjaro installation.sh
Last active April 16, 2022 05:54
Things I do After installation of manjaro distribution
manjaro
sudo pacman -Syu
#install lts kernel
#kde settings
# night mode
#ignore linux kernel updates
@pourmand1376
pourmand1376 / ubuntu_font.sh
Last active March 27, 2022 11:13
Install `ubuntu font` in Fedora 35
cd /tmp
wget https://assets.ubuntu.com/v1/fad7939b-ubuntu-font-family-0.83.zip
# you can check for newer versions
unzip fad7939b-ubuntu-font-family-0.83.zip
# then copy it to the font directory (applied to all users)
sudo cp -r ubuntu-font-family-0.83 /usr/share/fonts
fc-cache -v
@pourmand1376
pourmand1376 / nvv.sh
Created April 15, 2022 18:05 — forked from WeiTang114/nvv.sh
Show username after each process in nvidia-smi.
#!/bin/bash
# Show username after each process in nvidia-smi
# like:
# ...
# +------------------------------------------------------+
# | Processes: GPU Memory |
# | GPU PID Type Process name Usage |
# |======================================================|
# | 0 150752 C python 830MiB | User: user1
# | 1 2185 C /usr/bin/python 1090MiB | User: user2
@pourmand1376
pourmand1376 / nvidia-smi2
Created April 16, 2022 05:44
Show User Info and CPU information per user in NVIDIA-SMI
nvidia-smi | tee /dev/stderr | awk '/ C / {print $3}' | xargs -r ps -up