Skip to content

Instantly share code, notes, and snippets.

View hatamiarash7's full-sized avatar
🤖
*beep boop* overworked !

Arash Hatami hatamiarash7

🤖
*beep boop* overworked !
View GitHub Profile
@hatamiarash7
hatamiarash7 / nginx.conf
Created September 16, 2017 21:22 — forked from mnshankar/nginx.conf
Nginix config for hosting multiple laravel projects in sibling folders.
server {
listen 80;
root /vagrant;
index index.html index.htm index.php app.php app_dev.php;
# Make site accessible from http://set-ip-address.xip.io
server_name 192.168.33.10.xip.io;
access_log /var/log/nginx/vagrant.com-access.log;
error_log /var/log/nginx/vagrant.com-error.log error;
@hatamiarash7
hatamiarash7 / LEARN-1.md
Created January 6, 2018 22:34
Create dot files/directories (ie .file) on Windows

How to create a .file or .folder on Windows

There are several ways

1. Rename

  • Create file.txt
  • Rename to .file., the last dot will be dropped, you'll have .file

Works the same with a file or a directory.

@hatamiarash7
hatamiarash7 / loggingGUI.py
Created January 12, 2018 22:10 — forked from bitsgalore/loggingGUI.py
Minimal threaded GUI application with logging to both text file and ScrolledText widget
#! /usr/bin/env python
import time
import threading
import logging
try:
import tkinter as tk # Python 3.x
import tkinter.scrolledtext as ScrolledText
except ImportError:
import Tkinter as tk # Python 2.x
import ScrolledText
@hatamiarash7
hatamiarash7 / Activity.java
Last active January 18, 2018 13:33
Android Animated Background
final ImageView backgroundOne = (ImageView) findViewById(R.id.background_one);
final ImageView backgroundTwo = (ImageView) findViewById(R.id.background_two);
final ValueAnimator animator = ValueAnimator.ofFloat(0.0f, 1.0f);
animator.setRepeatCount(ValueAnimator.INFINITE);
animator.setInterpolator(new LinearInterpolator());
animator.setDuration(10000L);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
@hatamiarash7
hatamiarash7 / .env.travis
Created January 18, 2018 21:40
Laravel Travis CI Config
APP_ENV=testing
APP_KEY=SomeRandomString
DB_CONNECTION=testing
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
@hatamiarash7
hatamiarash7 / LEARN-2.md
Last active December 19, 2023 23:52
Make Git Repository From Existing Directory
  • Create Repository in github.com
  • Go into the directory containing the project.
  • Type git init
  • Type git add . to add all of the relevant files.
  • Type git commit
  • Type git remote add origin https://github.com/<username>/<repo-name>
  • Type git config --global push.default simple
  • Type git branch --set-upstream-to=origin/master
  • Type git push
@hatamiarash7
hatamiarash7 / commands.md
Last active June 9, 2022 03:23
CentOS + Apache + Django + WSGI + CWP + Python3.6
  • yum install python36u python36u-devel python36u-mod_wsgi
  • alias python='/usr/bin/python3.6'
  • curl -O https://bootstrap.pypa.io/get-pip.py
  • python get-pip.py
  • python -m pip install django mysqlclient
  • cp /etc/httpd/modules/mod_wsgi_python3.6.so /usr/local/apache/modules
  • create/clone/move project to another location ( not /home/user/public_html ) because there is not any access to top level directories
  • config apache
  • make & config database ( project/settings.py )
  • convert charset ALTER TABLE table CONVERT TO CHARACTER SET utf8;
@hatamiarash7
hatamiarash7 / LEARN-3.md
Created January 19, 2018 16:14
Curl Send Firebase Android Notification

curl -X POST --header "Authorization: key=" --Header "Content-Type: application/json" https://fcm.googleapis.com/fcm/send -d "{\"to\":\"\",\"notification\":{\"body\":\"Yellow\"},\"priority\":10}"

@hatamiarash7
hatamiarash7 / main.py
Created January 20, 2018 14:01
Python - Remove duplicate items in list of model objects
import toolz
class Token(object):
def __init__(self, id, token):
self.id = id
self.token = token
def get_id(self):
return self.id
@hatamiarash7
hatamiarash7 / nginx.conf
Created February 13, 2018 18:59
Force Nginx to use HTTPS
server {
listen 80;
server_name mysite.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443;
...
...