Skip to content

Instantly share code, notes, and snippets.

View esnosy's full-sized avatar

Eyad Ahmed esnosy

  • Egypt
  • 11:17 (UTC +03:00)
View GitHub Profile
@esnosy
esnosy / MoveCamera.cs
Created July 13, 2017 06:46 — forked from JISyed/MoveCamera.cs
Camera movement script in Unity3D. Supports rotating, panning, and zooming. Attach to the main camera. Tutorial explaining code: http://jibransyed.wordpress.com/2013/02/22/rotating-panning-and-zooming-a-camera-in-unity/
// Credit to damien_oconnell from http://forum.unity3d.com/threads/39513-Click-drag-camera-movement
// for using the mouse displacement for calculating the amount of camera movement and panning code.
using UnityEngine;
using System.Collections;
public class MoveCamera : MonoBehaviour
{
//
// VARIABLES
@esnosy
esnosy / index.html
Created July 20, 2019 16:10
Prayer Times using API
<iframe id="iframe3" style="background: rgb(255, 255, 255) none repeat scroll 0% 0%; border: 0px solid rgb(238, 238, 238); width: 100%; overflow: hidden; height: 199px;" src="https://timesprayer.today/widget_frame.php?frame=3&amp;id=564&amp;sound=false"></iframe>
@esnosy
esnosy / linsolve.py
Last active November 25, 2019 23:45
parse linear equation string and solve for x
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 17 05:15:31 2019
@author: Iyad
"""
def dif(f, x, h = .001):
return (f(x+h)-f(x))/h
def nsolve(f, err = .001):
x = 0
@esnosy
esnosy / paint.py
Created November 2, 2019 16:57 — forked from nikhilkumarsingh/paint.py
A simple paint application using tkinter in Python 3
from tkinter import *
from tkinter.colorchooser import askcolor
class Paint(object):
DEFAULT_PEN_SIZE = 5.0
DEFAULT_COLOR = 'black'
def __init__(self):
@esnosy
esnosy / sel2VG.py
Last active October 7, 2021 10:50
Create new vertex group from selected vertices(idea by MooKorea #3998 on discord)
# NOTE: blender already has this functionality
bl_info = {
"name": "Vertex Group From Selected",
"author": "Iyad Al-Sonoussi(AKA Human/Redivider/CGOnFire)",
"version": (0,1),
"blender": (2, 80, 0),
"location": "VIEW3D > Vertex Context Menu > New Vertex Group",
"description": "Create Vertex Group From Selected Vertices",
"warning": "",
@esnosy
esnosy / main.cpp
Last active December 4, 2019 22:10
simple calculator with numerical input and zero division checks
#include <iostream>
using namespace std;
float safein(){
float n;
cout << "Enter a number: ";
while (!(cin >> n)){
cout << "ERR: NOT A NUMBER!" << endl;
cin.clear();
cin.ignore(256, '\n');
}
@esnosy
esnosy / redirect.html
Created December 4, 2019 19:20
Simple JavaScript redirect
<script>
window.location.assign("https://www.google.com")
</script>
<div dir="rtl" style="text-align: right;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
</div>
@esnosy
esnosy / main.cpp
Created December 9, 2019 00:14
simple_area_calculator
#include <iostream>
using namespace std;
const float pi = 3.14159265359;
float safein(string ask){
float n;
cout << ask;
while (!(cin >> n)){
cout << "ERR: NOT A NUMBER!" << endl;
cin.clear();
cin.ignore(256, '\n');
@esnosy
esnosy / main.cpp
Created December 10, 2019 20:13
Factorial calculator with *safe input and overflow check
#include <iostream>
#include <cmath>
using namespace std;
double safein(string ask){
cout << ask << endl;
double x;
while(!(cin >> x) || x - floor(x)){
cout << "Not an integer!\n";
cin.clear();
cin.ignore(256,'\n');
@esnosy
esnosy / vscuda8fix.py
Last active August 16, 2020 15:06
Fix CUDA 8 projects to work with Visual Studio 2017-2019+
# the code is ugly I know
import sys
import os
if (len(sys.argv)> 1):
file = sys.argv[1]
if file.endswith(".vcxproj"):
def fix(file):
with open(file) as proj: