Skip to content

Instantly share code, notes, and snippets.

@takenoco82
takenoco82 / mysql_error_1148.md
Created November 17, 2018 07:41
MySQLのCSVインポートで ERROR 1148 (42000) が発生した際の対処方法

CSVファイルのインポートで ERROR 1148 (42000) が発生した際の対処方法

結論

以下のエラーが発生したら、サーバー・クライアント両方の local_infile オプションを 1 に設定してやる

mysql> LOAD DATA LOCAL INFILE '/tmp/users.csv' INTO TABLE users FIELDS TERMINATED BY ',' ENCLOSED BY '"';
ERROR 1148 (42000): The used command is not allowed with this MySQL version

サーバー側の設定

@topleague
topleague / twitter-card-genesis.php
Created September 2, 2017 18:55
Code for Adding Twitter Cards
//Code for Adding Twitter Cards
add_action('wp_head', 'add_twitter_cards');
function add_twitter_cards() {
if(is_single()) {
$tc_url = get_permalink();
$tc_title = get_the_title();
$tc_description = get_the_excerpt();
$tc_image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), full );
$tc_image_thumb = $tc_image[0];
$tc_author = str_replace('@', '', get_the_author_meta('twitter'));
@evnm
evnm / gist:d17336bf42e887c6e756
Created June 10, 2015 23:39
Script to convert milliseconds since epoch to a human-readable timestamp
#!/usr/bin/python
import datetime
import sys
print datetime.datetime.fromtimestamp(float(sys.argv[1])/1000).strftime('%Y-%m-%d %H:%M:%S.%f')
@studiopress
studiopress / credits-1.php
Last active April 26, 2023 15:09
Genesis footer.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Customize the credits
add_filter( 'genesis_footer_creds_text', 'sp_footer_creds_text' );
function sp_footer_creds_text() {
echo '<div class="creds"><p>';
echo 'Copyright &copy; ';
echo date('Y');
echo ' &middot; <a href="http://mydomain.com">My Custom Link</a> &middot; Built on the <a href="http://www.studiopress.com/themes/genesis" title="Genesis Framework">Genesis Framework</a>';
@mariomartinezsz
mariomartinezsz / buscapdf.py
Created January 5, 2013 20:20
Find links to pdf files in HTML with BeautifulSoup (Just one level)
import urllib2
from bs4 import BeautifulSoup
my_url = 'http://slav0nic.org.ua/static/books/python/'
html=urllib2.urlopen(my_url).read()
sopa = BeautifulSoup(html)
current_link = ''
for link in sopa.find_all('a'):
current_link = link.get('href')
if current_link.endswith('pdf'):
print('Tengo un pdf: ' + current_link)