Value | Color |
---|---|
\e[0;30m | Black |
\e[0;31m | Red |
\e[0;32m | Green |
\e[0;33m | Yellow |
\e[0;34m | Blue |
\e[0;35m | Purple |
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
def sha256_file(file_path, chunk_size=65336): | |
""" | |
Get the sha 256 checksum of a file. | |
:param file_path: path to file | |
:type file_path: unicode or str | |
:param chunk_size: number of bytes to read in each iteration. Must be > 0. | |
:type chunk_size: int | |
:return: sha 256 checksum of file | |
:rtype : str | |
""" |
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 | |
def dirwalk(directory): | |
"walk a directory tree, using a generator" | |
for name in os.listdir(directory): | |
fullpath = os.path.join(directory, name) | |
if os.path.isdir(fullpath) and not os.path.islink(fullpath): | |
for name in dirwalk(fullpath): # recurse into subdir | |
yield name |
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
"""Example to cancel a set of asyncio coroutines (futures), | |
using one coroutine to signal the event loop to stop. | |
""" | |
import asyncio | |
import logging | |
from datetime import datetime | |
from concurrent.futures import CancelledError | |
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 | |
/** | |
* @file | |
* Class PdfParser | |
* | |
* @author : Sebastien MALOT <sebastien@malot.fr> | |
* @date : 2013-08-08 | |
* | |
* References : |
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 | |
$server = 'ssl://example.com'; | |
$port = 12345; | |
$pass = 'pass'; | |
$nick = 'user'; | |
$channel = '#channel'; | |
function send( $conn, $msg ) | |
{ |
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 | |
/** | |
* Send a Message to a Slack Channel. | |
* | |
* In order to get the API Token visit: https://api.slack.com/custom-integrations/legacy-tokens | |
* The token will look something like this `xoxo-2100000415-0000000000-0000000000-ab1ab1`. | |
* | |
* @param string $message The message to post into a channel. | |
* @param string $channel The name of the channel prefixed with #, example #foobar |
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
// Fix Vendor Prefixes | |
var IS_CHROME = !!window.webkitRTCPeerConnection, | |
RTCPeerConnection, | |
RTCIceCandidate, | |
RTCSessionDescription; | |
if (IS_CHROME) { | |
RTCPeerConnection = webkitRTCPeerConnection; | |
RTCIceCandidate = window.RTCIceCandidate; | |
RTCSessionDescription = window.RTCSessionDescription; |
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 | |
import curses | |
import curses.textpad | |
import time | |
stdscr = curses.initscr() | |
#curses.noecho() | |
#curses.echo() |
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 | |
function make_links($text, $class='', $target='_blank'){ | |
return preg_replace('!((http\:\/\/|ftp\:\/\/|https\:\/\/)|www\.)([-a-zA-Zа-яА-Я0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?!ism', '<a class="'.$class.'" href="//$3" target="'.$target.'">$1$3</a>', $text); | |
} | |
define("APP_ID", 'xxxxxxxxxxxxxxxxxxx'); | |
define("APP_SECRET",'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); | |
define("PAGE_ID",'elnuevodia'); | |
$config = array( | |
'appId' => APP_ID, |