Skip to content

Instantly share code, notes, and snippets.

View RamiAwar's full-sized avatar
🎯
Working on Pet, Dataline, and SQLAlchemy stuff

Rami Awar RamiAwar

🎯
Working on Pet, Dataline, and SQLAlchemy stuff
View GitHub Profile
@RamiAwar
RamiAwar / TweetBox
Created July 11, 2015 11:20
Simple (bootstrap/jquery) tweetbox (Frontend only wired)
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Simple bootstrap and js tweetbox without React.js">
<script src="http://fb.me/react-0.13.1.js"></script>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js">
</script>
<meta charset="utf-8">
<div id="curtain1"></div>
<div id="curtain2"></div>
<div id="key"></div>
<div id="mask"></div>
<div class="title">Delve Into My...</div>
<div class="wrapper">
@RamiAwar
RamiAwar / python_support.js
Created May 24, 2018 11:24
Example node server with python compilation support
var spawn = require("child_process").spawn;
var fs = require('fs');
var runPythonFile = function (filepath, fileName, stdin, callback, process_list) {
var proc1 = spawn('python3', [filepath + fileName + '.py']);
var stdout1 = "";
var stderr1 = "";
@RamiAwar
RamiAwar / poly_derivative.py
Created November 17, 2018 19:38
Polynomial-Derivative-Python Getting a polynomial's derivative using regex in python. ##How it works The input polynomial string is divided into an array of coefficients and an array of corresponding powers. Each coefficient is multiplied by the power and each power is decremented by one. (Simple derivativation) At the end the new coefficients a…
import re
def derivative(polynomial):
coefficient = re.findall(r'-?[\d]*[x$]', polynomial)
power = re.findall(r'[\^][-]?[\d$]+', polynomial)
derivative_polynomial = []
@RamiAwar
RamiAwar / random.gd
Last active May 10, 2020 06:51
Random number generator setup
# Random number generator setup
var rng = RandomNumberGenerator.new()
func _ready():
rng.randomize()
@RamiAwar
RamiAwar / input.gd
Created May 10, 2020 07:35
Generating map upon space key pressed
func _input(event):
if Input.is_key_pressed(KEY_SPACE):
_init_grid()
_clear_tilemaps()
_create_random_path()
_spawn_tiles()
func _init_walkers():
...
walker.pos = Vector2(width/2, height/2)
...
extends Node2D
onready var dirt_tilemap = $DirtTileMap
onready var wall_tilemap = $WallTileMap
var rng = RandomNumberGenerator.new()
var CellSize = Vector2(32, 32)
var width = 2048/CellSize.x
var height = 1216/CellSize.y
'''This python code performs face tracking and simulates scrolling. First, the image feed is recieved from the camera. A facial detection algorithm is applied
once in every 5 frames. On detecting the face, a rectangular frame is drawn around the detected face, and the deviation from the center of the screen to the center of the face is taken as the scroll delta.
Requires Python + OpenCV'''
import cv2
from pynput.mouse import Button, Controller
mouse = Controller()
HAAR_CASCADE_PATH = "haarcascade_frontalface_alt.xml"