Skip to content

Instantly share code, notes, and snippets.

View CodingBat-Logic-2-make_bricks.py
def make_bricks(small, big, goal):
if goal - 5*big > small: # small + 5*big < goal (impossible)
return False
else: # small + 5*big >= goal (partial possible)
if goal%5 > small:
return False
else:
return True
@nosada
nosada / mozc-ut.patch
Last active Dec 25, 2015
for explanation on my blog
View mozc-ut.patch
--- PKGBUILD 2013-10-01 20:08:12.000000000 +0900
+++ PKGBUILD.changed 2013-10-13 20:50:55.703547957 +0900
@@ -5,9 +5,9 @@
##
## You can choose the input method framework to use either ibus and/or uim.
## If you will not be using ibus, comment out below.
-_ibus_mozc="yes"
+#_ibus_mozc="yes"
## If you will be using uim, uncomment below.
-#_uim_mozc="yes"
@nosada
nosada / qtemu.patch
Last active Dec 23, 2015
patch for qtemu's PKGBUILD (patching src/machinetab.cpp and generating .desktop by gendesk)
View qtemu.patch
--- PKGBUILD 2013-09-23 07:06:52.000000000 +0900
+++ PKGBUILD.changed 2013-09-22 15:53:36.000000000 +0900
@@ -12,12 +12,17 @@
makedepends=('cmake')
depends=('qemu' 'qt4')
source=(http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.bz2
- http://qtemu.svn.sourceforge.net/viewvc/qtemu/trunk/qtemu/misc/qtemu.desktop)
+ machinetab.patch)
md5sums=('3b93e209dc62e52a1d94c8eb24d0b149'
- 'b323b75384fdb327728d2603979f7202')
@nosada
nosada / machinetab.patch
Created Sep 22, 2013
patch for qtemu-1.0.5/machinetab.cpp
View machinetab.patch
--- machinetab.cpp.old 2007-11-13 04:31:00.000000000 +0900
+++ machinetab.cpp 2013-09-22 15:33:23.563347043 +0900
@@ -137,13 +137,13 @@
memoryFrameLayout->addWidget(memoryDescriptionLabel);
memorySlider = new QSlider(Qt::Horizontal, this);
- memorySlider->setRange(4, 1024);
+ memorySlider->setRange(4, 4096);
memorySlider->setSingleStep(4);
memorySlider->setTickPosition(QSlider::TicksBelow);
@nosada
nosada / crfpp.patch
Created Sep 22, 2013
patch for crfpp
View crfpp.patch
--- PKGBUILD.old 2013-07-13 21:34:18.054183257 +0900
+++ PKGBUILD 2013-07-13 21:29:29.661837910 +0900
@@ -6,19 +6,19 @@
pkgrel=1
pkgdesc="A Conditional Random Field implementation"
url="http://crfpp.sourceforge.net"
-arch=(x86_64 i686)
-license=(LGPL BSD)
-source=(http://crfpp.googlecode.com/files/CRF%2B%2B-${pkgver}.tar.gz)
+arch=('x86_64' 'i686')
@nosada
nosada / config
Last active Aug 29, 2015
zcat /proc/config.gz
View config
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 3.17.4-1 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
@nosada
nosada / mecab.setup.patch
Created Oct 27, 2014
patch for mecab-python-0.996/setup.py
View mecab.setup.patch
--- setup.py.orig 2014-10-27 23:13:54.149118580 +0900
+++ setup.py 2014-10-27 23:32:14.945120395 +0900
@@ -7,7 +7,7 @@
return os.popen(str).readlines()[0][:-1]
def cmd2(str):
- return string.split (cmd1(str))
+ return cmd1(str).split()
setup(name = "mecab-python",
@nosada
nosada / fcitx-mozc-ut.PKGBUILD
Last active Aug 29, 2015
Modified PKGBUILD and patch for original (https://aur.archlinux.org/packages/fcitx-mozc-ut/) for using latest mozc-ut
View fcitx-mozc-ut.PKGBUILD
# Maintainer: Naoya Inada <naoina@kuune.org>
# fcitx-mozc-ut is based on fcitx-mozc and mozc-ut.
##
## Build configuration
##
## ニコニコ大百科IME辞書 (NICONICOPEDIA IME dictionary, see below)
#_NICODIC="true"
#
## If you want to use an English-Japanese dictionary,
@nosada
nosada / yotify.sh
Last active Aug 29, 2015
comfortable operation with Yo
View yotify.sh
#!/usr/bin/sh
token="<YOUR_API_TOKEN>"
name="<DESIRED_USERNAME>"
notifymsg="Yo from <SOURCE_Yo_NAME> to <DESTINATION_Yo_NAME>"
icon="/path/to/icon"
# do desired task
$@
View gif.sh
#!/bin/sh
directory="./*"
for filepath in ${directory}
do
if [ ! -f ${filepath} ]; then
echo "${filepath}"
cd ${filepath}
convert *.png anime.gif