Skip to content

Instantly share code, notes, and snippets.

View hanigamal's full-sized avatar
🎯
Focusing at office

Hani Gamal hanigamal

🎯
Focusing at office
View GitHub Profile
@hanigamal
hanigamal / Batch File Rename.scpt
Created April 8, 2017 22:44 — forked from oliveratgithub/Batch File Rename.scpt
Simple AppleScript to easily batch rename multiple files sequentially. GUI asks user to select files and input a name before renaming.
-- This code comes from https://gist.github.com/oliveratgithub/
-- Open in AppleScript Editor and save as Application
-- ------------------------------------------------------------
--this is required to break the filename into pieces (separate name and extension)
set text item delimiters to "."
tell application "Finder"
set all_files to every item of (choose file with prompt "Choose the Files you'd like to rename:" with multiple selections allowed) as list
display dialog "New file name:" default answer ""
set new_name to text returned of result
--now we start looping through all selected files. 'index' is our counter that we initially set to 1 and then count up with every file.
@hanigamal
hanigamal / index.html
Created April 8, 2017 22:41 — forked from oliveratgithub/index.html
Simple, quick & standalone HTML5 responsive placeholder Website. Runs by simply copy-paste the whole code without any additional resource files. It's based on PureCSS.io with jQuery containing a fullstretch-background image plugin and a date-time countdown; kudos to unsplash.it for beautiful placeholder images.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Dummy Page</title>
<meta name="description" content="Simple, quick, standalone responsive placeholder Website without any additional resources">
<meta name="author" content="https://gist.github.com/oliveratgithub">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/purecss@0.6.1/build/pure-min.css" integrity="sha384-CCTZv2q9I9m3UOxRLaJneXrrqKwUNOzZ6NGEUMwHtShDJ+nCoiXJCAgi05KfkLGY" crossorigin="anonymous">
<!--[if lt IE 9]>
@hanigamal
hanigamal / GoPro RTMP streaming with FFmpeg
Created April 2, 2017 02:00 — forked from laurieainley/GoPro RTMP streaming with FFmpeg
Live streaming from a GoPro Hero3 camera to RTMP server using FFmpeg
Basic Requirements:
Computer with wired and wireless connection
FFmpeg installation: http://www.ffmpeg.org/
GoPro Hero 3+: http://gopro.com/
RTMP server e.g. FMS (http://www.adobe.com/products/adobe-media-server-family.html) or CDN ingest point
Overview:
GoPro Hero3 cameras produce HLS streams which are consumed by control apps and their removeable monitor.
@hanigamal
hanigamal / fileInput.css
Created March 24, 2017 23:49 — forked from barneycarroll/fileInput.css
Total input[type=file] style control with pure CSS. File type inputs are notoriously hard to style, due to different semi-serious style restrictions in the name of security (the argument being that a file input presents access to the user's private file system, and should as such always look unambiguously like what it is — redundant if you ask m…
.fileContainer {
overflow: hidden;
position: relative;
}
.fileContainer [type=file] {
cursor: inherit;
display: block;
font-size: 999px;
filter: alpha(opacity=0);
@hanigamal
hanigamal / bigdump.php
Created August 26, 2016 04:08 — forked from chrisjlee/bigdump.php
BigDump: Staggered MySQL Dump Importer. Allows you to import large mysql dump files in a staggered way. Stolen from: http://www.ozerov.de/bigdump/ version 0.35
<?php
error_reporting(E_ALL);
// BigDump ver. 0.35b from 2012-12-26
// Staggered import of an large MySQL Dump (like phpMyAdmin 2.x Dump)
// Even through the webservers with hard runtime limit and those in safe mode
// Works fine with Internet Explorer 7.0 and Firefox 2.x
// Author: Alexey Ozerov (alexey at ozerov dot de)
@hanigamal
hanigamal / clean-raspberry.sh
Created October 10, 2015 01:06 — forked from bivald/clean-raspberry.sh
Clean Raspberry Pi Debian
#!/bin/bash
sudo apt-get --yes purge xserver* x11-common x11-utils x11-xkb-utils x11-xserver-utils xarchiver xauth xkb-data console-setup xinit lightdm libx{composite,cb,cursor,damage,dmcp,ext,font,ft,i,inerama,kbfile,klavier,mu,pm,randr,render,res,t,xf86}* lxde* lx{input,menu-data,panel,polkit,randr,session,session-edit,shortcut,task,terminal} obconf openbox gtk* libgtk* alsa* nano python-pygame python-tk python3-tk scratch tsconf
sudo apt-get -y purge aspell hunspell-en-us iptraf libaspell15 libhunspell-1.2-0 lxde lxsession lxtask lxterminal squeak-vm whiptail zenity gdm gnome-themes-standard python-pygame
apt-get --yes purge xdg-tools desktop-file-utils omxplayer python3-numpy python3
sudo apt-get remove xserver-xorg
sudo apt-get purge ^lx
sudo apt-get --yes autoremove
sudo apt-get --yes autoclean
sudo apt-get --yes clean
@hanigamal
hanigamal / snaptoroad.js
Last active February 25, 2019 14:54 — forked from omkz/snaptoroad.js
google maps API javascript v3 - polyline snap to road
var directionsService = new google.maps.DirectionsService();
directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
var polyline = new google.maps.Polyline(polylineOptions);
var path = response.routes[0].overview_path;
for (var x in path) {
@hanigamal
hanigamal / remove_empty_value.js
Last active August 29, 2015 14:27 — forked from nuwansh/remove_empty_value.js
Remove empty elements from an array in Javascript and join it as string
/**This is example works with only jQuery
* @usecase, if you have an array with empty values (ex: ["I", "", "want", "", "to", "go", "" ])
* but you want to return this array as a string.
*/
var myRoom = {
myAction: function(array){
garray = $.grep(array,function(n){
return(n);
});
@hanigamal
hanigamal / Stats-animation..markdown
Created January 24, 2015 10:26
Stats animation.

Stats animation.

I loved Virgil's Dribble shot and decided to remake it with some SVG animations :) I didn't really want to recreate the curvy line since I believe straight lines are more accurate. Sorry Virgil, I might make them curvy one day :)! With a bit of time on my hands I could make it even more detailed. I hope you like it and post some feedback on how to make this better :)! Don't forget to check out the original at http://goo.gl/0aKiS0

Kudos Virgil!

Forked from Jonas Badalic's Pen Stats animation..

@hanigamal
hanigamal / gist:1335186bd90c4e55ad30
Last active August 29, 2015 14:09
Drawing Examples
/*
Draw Rectangles
@include <canvas>
@use fillRect() or fill() or stroke() to render to canvas
*/
function drawRects() {
var ctx = document.getElementById('canvas').getContext('2d');
ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect(10, 10, 55, 50);