Skip to content

Instantly share code, notes, and snippets.

Ilgrim Ilgrim

Block or report user

Report or block Ilgrim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Ilgrim
Ilgrim / sha256_file.py
Created Aug 22, 2017 — forked from eas604/sha256_file.py
sha256 file checksum function in python
View sha256_file.py
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
"""
@Ilgrim
Ilgrim / dirwalk.py
Created Aug 22, 2017 — forked from gkalab-snippets/dirwalk.py
Python: dirwalk
View dirwalk.py
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
@Ilgrim
Ilgrim / gist:43702323d830c0222be37ae023fc0b18
Created Aug 24, 2017 — forked from evertrol/gist:47325e62f8caae1b72ee
Asyncio: cancel a set of coroutines from another coroutine, by stopping the event loop
View gist:43702323d830c0222be37ae023fc0b18
"""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
@Ilgrim
Ilgrim / PdfParser.php
Created Oct 21, 2017 — forked from smalot/PdfParser.php
Use this static class to extract Text from Pdf files. It supports compressed and uncompressed Pdf (version 1.1 to 1.7) : tested It supports octal encoded (eg : \050) content, but not hexadecimal (eg : <005E>). In some cases, it works better than "pdftotext" binary tool.
View PdfParser.php
<?php
/**
* @file
* Class PdfParser
*
* @author : Sebastien MALOT <sebastien@malot.fr>
* @date : 2013-08-08
*
* References :
@Ilgrim
Ilgrim / irc.php
Created Oct 24, 2017 — forked from Xeoncross/irc.php
Test IRC client bot in PHP
View irc.php
<?php
$server = 'ssl://example.com';
$port = 12345;
$pass = 'pass';
$nick = 'user';
$channel = '#channel';
function send( $conn, $msg )
{
@Ilgrim
Ilgrim / PostMessageToSlackChannel.php
Created Oct 24, 2017 — forked from nadar/PostMessageToSlackChannel.php
Post a message to a slack channel with PHP
View PostMessageToSlackChannel.php
<?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
@Ilgrim
Ilgrim / webrtc.js
Created Nov 30, 2017 — forked from dristic/webrtc.js
Full code from my WebRTC Data Channel post.
View webrtc.js
// Fix Vendor Prefixes
var IS_CHROME = !!window.webkitRTCPeerConnection,
RTCPeerConnection,
RTCIceCandidate,
RTCSessionDescription;
if (IS_CHROME) {
RTCPeerConnection = webkitRTCPeerConnection;
RTCIceCandidate = window.RTCIceCandidate;
RTCSessionDescription = window.RTCSessionDescription;
@Ilgrim
Ilgrim / cs.py
Last active Jan 1, 2018 — forked from myano/cs.py
Quick example of ncurses in Python!
View cs.py
#!/usr/bin/env python
import curses
import curses.textpad
import time
stdscr = curses.initscr()
#curses.noecho()
#curses.echo()
@Ilgrim
Ilgrim / bash-colors.md
Created Jan 1, 2018 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.
View bash-colors.md

Regular Colors

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
@Ilgrim
Ilgrim / posts_from_page.php
Created Jan 4, 2018 — forked from morales2k/posts_from_page.php
Get Facebook public posts from a page. This requires facebook's php sdk, and a properly registered app.
View posts_from_page.php
<?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,
You can’t perform that action at this time.