Skip to content

Instantly share code, notes, and snippets.

$ sqlite3 t.db
SQLite version 3.7.7.1 2011-06-28 17:39:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> CREATE TABLE t1(_id INTEGER, col1 VARCHAR(255));
sqlite> select * from t1;
sqlite> .schema t1
CREATE TABLE t1(_id INTEGER, col1 VARCHAR(255));
sqlite> CREATE TABLE t2(_id INTEGER, col1 VARCHAR(255), col2 INTEGER, PRIMARY KEY(_id, col2));
sqlite> .schema t2
sqlite> CREATE TABLE t3(_id INTEGER PRIMARY KEY AUTOINCREMENT, col1 VARCHAR(255), col2 INTEGER);
sqlite> CREATE UNIQUE INDEX idx_uniq ON t3(_id, col1, col2);
sqlite> .schema t3
CREATE TABLE t3(_id INTEGER PRIMARY KEY AUTOINCREMENT, col1 VARCHAR(255), col2 INTEGER);
CREATE UNIQUE INDEX idx_uniq ON t3(_id, col1, col2);
@muojp
muojp / gist:3634179
Created September 5, 2012 09:40
末尾全角スペースの罠DBとか怖いって話を社内でしてた
mysql> create database `foo`;
mysql> create database `foo `;
mysql> create database `foo  `;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| foo |
@muojp
muojp / gist:3786383
Created September 26, 2012 06:14
ARDrone SDK 2.0のビルドがコケるのをなんとかするパッチ
96c96
< grep -r ^\#define ../../ARDroneLib/Soft/Common/navdata_common.h | grep NB_NAVDATA_DETECTION_RESULTS | sed 's/^\#define NB_NAVDATA_DETECTION_RESULTS \(.*\)/\#define ARDRONE_MAX_ENEMIES \1/g' | sed 's/\/\*.*\*\///' >> Release/ARDroneGeneratedTypes.h
---
> grep -h -r ^\#define ../../ARDroneLib/Soft/Common/navdata_common.h | grep -h NB_NAVDATA_DETECTION_RESULTS | sed 's/^\#define NB_NAVDATA_DETECTION_RESULTS \(.*\)/\#define ARDRONE_MAX_ENEMIES \1/g' | sed 's/\/\*.*\*\///' >> Release/ARDroneGeneratedTypes.h
100c100
< grep -r ^LED_ANIMATION\( ../../ARDroneLib/Soft/Common/led_animation.h | tr -d ' ' | tr -d '\t' | sed 's/^LED_ANIMATION(\([A-Za-z_0-9=]*\),\(.*\))/ARDRONE_LED_ANIMATION_\1,/g' | sed 's/\/\*.*\*\///' >> Release/ARDroneGeneratedTypes.h
---
> grep -h -r ^LED_ANIMATION\( ../../ARDroneLib/Soft/Common/led_animation.h | tr -d ' ' | tr -d '\t' | sed 's/^LED_ANIMATION(\([A-Za-z_0-9=]*\),\(.*\))/ARDRONE_LED_ANIMATION_\1,/g' | sed 's/\/\*.*\*\///' >> Release/ARDroneGeneratedTypes.h
105c105
< grep -r "\s*A
@muojp
muojp / Main.cs
Created November 5, 2012 08:37
repro. code for JavaScriptSerializer bug in Mono 3.0
using System;
using System.Collections.Generic;
using System.Web.Script.Serialization;
namespace TestsForMono
{
class MainClass
{
public static void Main (string[] args)
{
@muojp
muojp / gist:4021738
Created November 6, 2012 01:01
binary format difference between Mono 3.0.0 bundled version of libgdiplus and my build
$ gobjdump -p /Library/Frameworks/Mono.framework/Versions/3.0.0_stable/lib/libgdiplus.dylib | head
/Library/Frameworks/Mono.framework/Versions/3.0.0_stable/lib/libgdiplus.dylib: ファイル形式 mach-o-i386
Mach-O header:
magic : feedface
cputype : 00000007 (i386)
cpusubtype: 00000003
filetype : 00000006 (dylib)
ncmds : 0000001c (28)
sizeofcmds: 00000b38
$ cat t.php
<?php
error_reporting(E_ALL);
typoclsname;
kei-mba13:tmp KeiNakazawa$ php t.php
Notice: Use of undefined constant typoclsname - assumed 'typoclsname' in /tmp/t.php on line 3
.method assembly static pinvokeimpl ("MSVCR110D.dll" as "malloc" cdecl lasterr )
default void* modopt ([mscorlib]System.Runtime.CompilerServices.CallConvCdecl) malloc (unsigned int32 A_0) cil managed preservesig
{
.custom instance void class [mscorlib]System.Security.SuppressUnmanagedCodeSecurityAttribute::'.ctor'() = (01 00 00 00 ) // ....
// Method begins at RVA 0x0
} // end of global method malloc
@muojp
muojp / gist:6227796
Created August 14, 2013 03:36
https://github.com/kmuto/review/pull/181 これを1.8.xと1.9.xで共に問題なく実行できそうなパッチ(VMの気持ちで考えたけど1.9.x試してない)
$ git diff -p
diff --git a/lib/review/htmlutils.rb b/lib/review/htmlutils.rb
index 64ef016..514ff53 100644
--- a/lib/review/htmlutils.rb
+++ b/lib/review/htmlutils.rb
@@ -39,15 +39,19 @@ module ReVIEW
begin
require 'pygments'
- Pygments.highlight(
@muojp
muojp / gist:7264689
Created November 1, 2013 12:27
Android NDK r9bでのドキュメント変更点がすごいと(自分の中で)話題に
$ git diff --name-status android-ndk-r9/docs android-ndk-r9b/docs | grep -v 'renderscript'
M android-ndk-r9/docs/APPLICATION-MK.html
M android-ndk-r9/docs/CHANGES.html
M android-ndk-r9/docs/CPU-ARCH-ABIS.html
M android-ndk-r9/docs/DEVELOPMENT.html
M android-ndk-r9/docs/STANDALONE-TOOLCHAIN.html
M android-ndk-r9/docs/sidenav.html
M android-ndk-r9/docs/text/APPLICATION-MK.text
M android-ndk-r9/docs/text/CHANGES.text
M android-ndk-r9/docs/text/CPU-ARCH-ABIS.text