This file contains hidden or 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 | |
$dir_ = '.'; | |
$scanned_directory = array_diff(scandir($dir_), array('..', '.')); | |
if (count($scanned_directory) > 0) { | |
foreach ($scanned_directory as $f_) { | |
$imagick1 = new Imagick(); | |
$imagick1->readImage($dir_.'/'.$f_); | |
$giw_ = $imagick1->getImageWidth(); | |
$gih_ = $imagick1->getImageHeight(); |
This file contains hidden or 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 | |
# -*- coding: utf-8 -*- | |
def load_gist(gist_id): | |
"""translate Gist ID to URL""" | |
from json import load | |
from urllib import urlopen | |
gist_api = urlopen("https://api.github.com/gists/" + gist_id) |
This file contains hidden or 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
''' | |
HTTP Reuests has following parameters: | |
1)Request URL | |
2)Header Fields | |
3)Parameter | |
4)Request body | |
''' | |
#!/usr/bin/env python | |
import requests |
This file contains hidden or 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 sublime | |
import sublime_plugin | |
import os | |
import sys | |
import json | |
import base64 | |
import urllib2 | |
import subprocess | |
import functools | |
import webbrowser |
This file contains hidden or 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 hashlib as hasher | |
import datetime as date | |
# Define what a Snakecoin block is | |
class Block: | |
def __init__(self, index, timestamp, data, previous_hash): | |
self.index = index | |
self.timestamp = timestamp | |
self.data = data | |
self.previous_hash = previous_hash |
This file contains hidden or 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 | |
class Mysql{ | |
static private $link = null; | |
static private $info = array( | |
'last_query' => null, | |
'num_rows' => null, | |
'insert_id' => null | |
); |
This file contains hidden or 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 translit($str) { | |
$tr = array("а"=>"a","б"=>"b","в"=>"v","г"=>"g","д"=>"d","е"=>"e","ё"=>"e","ж"=>"j","з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l","м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r","с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h","ц"=>"c","ч"=>"ch","ш"=>"sh","щ"=>"shh","ъ"=>"","ы"=>"y","ь"=>"","э"=>"e","ю"=>"u","я"=>"ya","—"=>"-","«"=>"","»"=>"","…"=>""," "=>"-","№"=>"#"); | |
$str = mb_strtolower($str,'utf-8'); | |
// $str = preg_replace("/\s+/",' ',$str); | |
$str = strtr(trim($str), $tr); | |
$str = trim(preg_replace("/\-+/",'-',$str),'- '); | |
$str = preg_replace('~[^a-z0-9/-]~', '', $str); | |
return $str; |
This file contains hidden or 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 translit_str( $str, $maxLength = 100, $encode = 'utf-8' ) { | |
$tr = array( | |
"А" => "a", | |
"Б" => "b", | |
"В" => "v", | |
"Г" => "g", | |
"Д" => "d", | |
"Е" => "e", | |
"Ё" => "yo", | |
"Ж" => "zh", |
This file contains hidden or 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 | |
class Mysql | |
{ | |
private $link = null; | |
private $info = array( | |
'last_query' => null, | |
'num_rows' => null, | |
'insert_id' => null | |
); |
This file contains hidden or 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 | |
# Script to convert PDF file to JPG images | |
# | |
# Dependencies: | |
# * pdftk | |
# * imagemagick | |
PDF=$1 |
NewerOlder