This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DEFAULT_WS="6:y" | |
filename=$(playerctl metadata xesam:url) | |
ext="${filename##*.}" | |
case "$ext" in | |
avi|mp4|mkv) | |
t=v | |
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, random | |
from time import sleep | |
def command(com): | |
return os.system('adb %s > /dev/null 2>&1' % com) | |
def reboot(): | |
return command('reboot') | |
def shell(com): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from twx.botapi import TelegramBot, send_message | |
import time | |
from collections import Counter | |
polls = {} | |
def aggregate_votes(votes): | |
return '\n'.join('%s: %s' % (k,v) for k,v in sorted(Counter(votes.values()).items(), key=lambda x:x[1])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from twx.botapi import TelegramBot, send_message | |
import time | |
d = {} | |
dr = {} | |
bot = TelegramBot('bot-token') | |
bot.update_bot_info().wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def calc(gross, delivery, d): | |
""" | |
usage: | |
>>> calc(120, 9, { | |
'Ashraf': 40, | |
'Thabet': 20, | |
'Awadi': 20, | |
'Ghanem': 20, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
function usage { | |
echo "usage: $0 [create|remove] netns_name [network_ip]" | |
exit 1 | |
} | |
if [ "$#" -lt "1" -o "$1" = "-h" -o "$1" = "--help" ]; then | |
usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name random_order | |
// @namespace otlob | |
// @description randomise order | |
// @include https://www.otlob.com/* | |
// @version 1 | |
// @grant none | |
// @authors Mohamed Elawadi <mohamed@elawadi.net>, Ahmed Thabet <xmonader@gmail.com> | |
// ==/UserScript== | |
Element.prototype.documentOffsetTop = function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function searchDeep(obj,query,objName){ | |
var a = [] | |
var b = function(obj,query,c){ | |
if(~(a.indexOf(obj))) return [] | |
a.push(obj) | |
var d = [] | |
if(query in obj){ | |
d.push(c) | |
} | |
for(var j in obj){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import re | |
import urllib | |
from multiprocessing import Pool | |
import requests | |
import progressbar | |
CHUNK_SIZE = 1024 * 1024 # 1MB | |
def download(i): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void change(int* xp){ //define "declare" pointer called xp , type "int*" NOT "int" | |
printf("0:%d\n",*xp); //print x - the value which pointer points to - old value | |
*xp=6; // change the value of x - using its addr - | |
printf("1:%d\n",*xp); //print x - the value which pointer points to - new value | |
printf("5:%p\n",xp); // print the pointer " the addr of var. x" | |
printf("2:%p\n",&xp); //print the addr of the pointer xp | |
} | |
int main(){ | |
int x=5; |