Skip to content

Instantly share code, notes, and snippets.

View level09's full-sized avatar
🌴
Always on vacation

Nidal Alhariri level09

🌴
Always on vacation
View GitHub Profile
@level09
level09 / shorturl.py
Created October 21, 2014 09:52
Short ID Generator
'''
Short URL Generator
===================
Python implementation for generating Tiny URL- and bit.ly-like URLs.
A bit-shuffling approach is used to avoid generating consecutive, predictable
URLs. However, the algorithm is deterministic and will guarantee that no
collisions will occur.
@level09
level09 / nu8
Created November 26, 2013 19:49
NU8 signature
<p style="font:arial 12px;color:#555;line-height:22px;">Martina Rohel<br>
CEO</p>
<p style="font:arial 12px;color:#555;line-height:22px;">
<img src="data:image/jpg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAABVAAD/4QNxaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjMtYzAxMSA2Ni4xNDU2NjEsIDIwMTIvMDIvMDYtMTQ6NTY6MjcgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6NzZEQzYzNkIyNzIwNjgxMThBNkREQTlBQ0IzRTQzNEQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjU4OTc4RkU0RUY0MTFFMzhFMURBRjM5NjgwRUE3NkUiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5
import java.io.File;
public class ListFiles
{
public static void main(String[] args)
{
// Directory path here
String path = ".";
@level09
level09 / gist:6579270
Created September 16, 2013 11:04
nginx in front of apache
server {
listen 80;
index index.html;
server_name alarabiya.net www.alarabiya.net;
location / {
@level09
level09 / gist:5764423
Last active December 18, 2015 09:49
Drupal Create node Programmatically
<?php
/*
* $custom_fields is array of format:
*
* array(
* array(
* 'field'=>'location',
* 'value'=> 'dubai',
* ),
$view = new view();
$view->name = 'popular_tags';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'taxonomy_term_data';
$view->human_name = 'Popular Tags';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
def youtube_upload(package):
if package.youtube == '1' or package.youtube == '2':
dev_email= G_USER
dev_password= G_PASS
dev_application= PROD_NAME
dev_key= API_KEY
youtube_user= YT_USER
http://www.alarabiya.local/ar/sitemap.xml.gz
http://www.alarabiya.local/ar/arab-and-world/sitemap.xml.gz
http://www.alarabiya.local/ar/arab-and-world/egypt/sitemap.xml.gz
http://www.alarabiya.local/ar/arab-and-world/egypt/event-files/sitemap.xml.gz
http://www.alarabiya.local/ar/arab-and-world/egypt/journalism/sitemap.xml.gz
http://www.alarabiya.local/ar/arab-and-world/egypt/coverage/sitemap.xml.gz
http://www.alarabiya.local/ar/arab-and-world/egypt/change/sitemap.xml.gz
http://www.alarabiya.local/ar/arab-and-world/egypt/candidate-cv/sitemap.xml.gz
http://www.alarabiya.local/ar/arab-and-world/egypt/candidates-programs/sitemap.xml.gz
http://www.alarabiya.local/ar/arab-and-world/egypt/constitution/sitemap.xml.gz
@level09
level09 / gist:5019433
Created February 23, 2013 11:30
iphone test
2013-02-23 15:28:55.921 aamobile[2477:1703] Reachability: -R -------
2013-02-23 15:28:56.170 aamobile[2477:907] App Delegate: Core Data: Persistent Store Cooordinator: Error Occured
2013-02-23 15:28:56.196 aamobile[2477:907] Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x1cdbce60 {metadata={
NSPersistenceFrameworkVersion = 419;
NSStoreModelVersionHashes = {
Article = <e67d71c4 ddc0413c df9937e9 2b014f29 534ea82e 09d3a64c 27027334 2bc03083>;
InfoView = <7c0835ba 31602ced 8f963e95 1be81967 9df533a1 70830baf 9ed8c76b bbc38a5b>;
Section = <82911e5d 90d03c46 df46d0b1 83c0f176 352f24fd e4db94d8 ed21e276 af06b326>;
SectionList = <ada1a794 3c26e5f5 49667729 b039f328 f84ad6b5 7fddb0e9 b1eaed00 9a47681a>;
SectionTime = <5582ff38 d5752191 adaf4f95 851ad77f 1b90e4c0 7db22931 441615e0 34b9f003>;
@level09
level09 / gist:4721760
Created February 6, 2013 10:31
video fabfile
from fabric.api import put, run , local , env
from fabric.contrib.files import exists
from settings import VOD_HOST, VOD_PATH, PHP_COMMAND,MAG_HOST, MAG_PATH
from glob import glob
import os
def vod():
env.hosts = [VOD_HOST]