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
<?php | |
# note: $_REQUEST["tz"] is variable of your timezone. arg example: Asia/Manila | |
if(isset($_REQUEST["tz"])){ | |
date_default_timezone_set($_REQUEST["tz"]); | |
$datetime = new DateTime(); | |
echo $datetime->format('Y-m-d H:i:s'); | |
die(); | |
} | |
?> |
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 psutil | |
addrs = psutil.net_if_addrs() | |
print(addrs.keys()) |
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 socket, psutil | |
from binascii import hexlify | |
# get mac address | |
def get_network_mac(interface, p=0): | |
# create dummy socket | |
s = socket.socket(socket.AF_PACKET, socket.SOCK_RAW) | |
# bind it with interface name | |
s.bind((interface,p)) |
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 subprocess | |
def get_master_volume(): | |
proc = subprocess.Popen('/usr/bin/amixer sget Master', shell=True, stdout=subprocess.PIPE) | |
amixer_stdout = proc.communicate()[0].split('\n')[4] | |
proc.wait() | |
find_start = amixer_stdout.find('[') + 1 | |
find_end = amixer_stdout.find('%]', find_start) | |
return float(amixer_stdout[find_start:find_end]) |
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 | |
try: | |
device = os.open("/dev/ttyUSB0", os.O_RDWR) | |
while 1: | |
print(os.read(device,255)) | |
finally: | |
os.close(device) |
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
document.getElementsByClassName("jsx-963942478 paywallWrapper")[0].remove(); | |
document.querySelector("body").setAttribute("style", "overflow: scroll;"); |
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
# all num is converted into float | |
def currency_format(num): | |
sol = str(float(num)).split(".") | |
sol[0] = sol[0][::-1] | |
final = "" | |
while len(sol[0]): | |
sol_r_e = sol[0][:3]#slice (get 3 characters) | |
sol[0] = sol[0][3:]#slice (decrease) | |
if len(sol_r_e) == 3 and not len(sol[0]) == 0:sol_r_e += "," | |
final += sol_r_e |
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 Tkinter | |
def make_textmenu(root): | |
global the_menu | |
the_menu = Tkinter.Menu(root, tearoff=0) | |
the_menu.add_command(label="Cut") | |
the_menu.add_command(label="Copy") | |
the_menu.add_command(label="Paste") | |
the_menu.add_separator() | |
the_menu.add_command(label="Select all") |
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
from HTMLParser import HTMLParser | |
class MyHTMLParser(HTMLParser): | |
def handle_starttag(self, tag, attrs): | |
print("Start tag:", tag) | |
for attr in attrs: | |
print(" attr:", attr) | |
def handle_endtag(self, tag): | |
print("End tag :", tag) |
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
/*HTML5Player Video Downloader using JavaScript. Proof of concept: x_*n_*x*_x_ LOL! */ | |
window.location=html5player.url_high; | |
/* | |
//or option 2: | |
obj=document.getElementsByClassName("transition")[2]; | |
obj.setAttribute("href",html5player.url_high); | |
obj.innerHTML="<h1>" + html5player.video_title + "</h1>"; | |
*/ |