Skip to content

Instantly share code, notes, and snippets.

View neet's full-sized avatar

Ryō Igarashi neet

View GitHub Profile
@neet
neet / MagicNumbers.py
Last active September 17, 2016 05:15
BINARY_TO_EXTENTION = {
"\x89\x50\x4e\x47" : ".png",
"\xff\xd8\xdd\xe0" : ".jpeg",
"\xff\xd8\xff\xee" : ".jpg",
"\x47\x49\x46\x38\x39\x61" : ".gif",
"\x47\x49\x46\x38\x37\x61" : ".gif",
"\x42\x4d" : ".bmp",
"\x00\x2a" : ".tiff",
}
#!-*- coding:utf-8 -*-
import htmlentitydefs
import re
# 実体参照 & 文字参照を通常の文字に戻す
def htmlentity2unicode(text):
# 正規表現のコンパイル
reference_regex = re.compile(u'&(#x?[0-9a-f]+|[a-z]+);', re.IGNORECASE)
num16_regex = re.compile(u'#x\d+', re.IGNORECASE)
num10_regex = re.compile(u'#\d+', re.IGNORECASE)
# -*- coding:utf-8 -*-
# PutException.py
def PutException(filepath,_exception):
f = open(filepath,"a")
f.write(_exception)
if __name__ == '__main__':
try:
num = 0/0
<h3>関連記事</h3>
<ul class="rel-in clearfix">
<?php
$tags = wp_get_post_tags($post->ID);
$tag_ids = array();
foreach($tags as $tag):
array_push( $tag_ids, $tag -> term_id);
endforeach ;
$args = array(
'post__not_in' => array($post -> ID),
import sys;import requests
from bs4 import BeautifulSoup
import re
def getKeyword_withurl(url,lang):
headers = {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0'
}
<?php
$url_encode=urlencode(get_permalink());
$title_encode=urlencode(get_the_title()).'|'.get_bloginfo('name');
?>
<div class="share_button">
<ul>
<li class="facebook">
<a href="http://www.facebook.com/sharer.php?u=<?php echo $url_encode;?>&amp;t=<?php echo $title_encode;?>" target="_blank">
&nbsp;<span class="icon-facebook2"></span>&nbsp;シェア&nbsp;
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http://nijipi.com/it-news/$4 [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
@neet
neet / style.css
Last active February 21, 2017 12:57
tweet-deck_glass
/*@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url("https://tweetdeck.twitter.com/") {*/
body .app-content {
background-color: rgba(255,255,255,0.0);
}
body .app-columns-container {
background-image: url(http://www.project-imas.com/w/images/4/4a/Miku_SS_SSR2.png);
@neet
neet / header-bar.php
Last active March 9, 2017 00:26
WordPress AMPtemplate for nijipico
<header id="#top" class="amp-wp-header">
<div>
<a href="<?php echo esc_url( $this->get( 'home_url' ) ); ?>">
<?php $site_icon_url = $this->get( 'site_icon_url' );
if ( $site_icon_url ) : ?>
<amp-img src="<?php echo esc_url( $site_icon_url ); ?>" width="32" height="32" class="amp-wp-site-icon"></amp-img>
<?php endif; ?>
<?php echo esc_html( $this->get( 'blog_name' ) ); ?>
</a>
</div>
# coding: UTF-8
from mastodon import Mastodon
my_instance = "https://mastodon.cloud"
Mastodon.create_app(
'testapp',
api_base_url = my_instance,
to_file = 'pytooter_clientcred.txt'
)