Skip to content

Instantly share code, notes, and snippets.

View manhg's full-sized avatar

Jan manhg

  • Tokyo, Japan
View GitHub Profile
@manhg
manhg / my.cnf
Created February 18, 2014 06:24
MySQL Config (OSX, 5.6) for reduced RAM usage (Normally ~400M, tuned into ~30M)
[mysqld]
join_buffer_size = 512K
sort_buffer_size = 64K
read_rnd_buffer_size = 256K
net_buffer_length=2K
thread_stack = 128K
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 1M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
@manhg
manhg / vhosts.conf
Created February 24, 2014 10:10
MacOSX apache development config
ServerName localhost
Listen 80
NameVirtualHost *:80
LogFormat "%h %l %u %t \"%r\" %>s %b" common
# General
<Directory "/path/projects">
php_admin_flag engine on
AllowOverride All
@manhg
manhg / iptables.conf
Created March 17, 2014 07:03
iptables.conf
*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,PSH,ACK,URG -j DROP
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
1
00:00:00,599 --> 00:00:04,160
>> ALICE: Hi, my name is Alice Miller and this is John Brown
2
00:00:04,160 --> 00:00:06,770
>> JOHN: and we're the owners of Miller Bakery.
3
00:00:06,770 --> 00:00:10,880
@manhg
manhg / ram.sh
Last active August 29, 2015 14:01
RAM Disk, SSD tuning
#!/bin/bash
# Optimize performance by using RAM disk
# Espcially improve life for SSD
# Disable access time
mount -vuwo noatime /
# Create RAM disk
ramfs_size_mb=256
<ul class="bxslider">
<?php
$obj = (object)['written_at' => '2014.05.01', 'title' =>「目線を変えれば、学生も変わる 学生指導に自信がもてるコツ」開催決定! '];
?>
@foreach (array_fill(0, 4, $obj) as $headline)
<li>
<a href="">
<div>
<dl>
<dt>{{ $headline->written_at }} </dt>
// Run after file saved
//
// Install Sass: sudo gem install sass
// Install CoffeeScript: npm install -g coffee-script
komodo.assertMacroVersion(3);
var koDoc = ko.views.manager.currentView.koDoc;
var input = koDoc.file.dirName + '/' + koDoc.file.baseName;
var barename = input.substr(0, input.length - koDoc.file.ext.length);
switch (koDoc.file.ext) {
// Komodo Edit editor marco
// Run after file saved using event
//
// Install Sass: sudo gem install sass
// Install CoffeeScript: npm install -g coffee-script
komodo.assertMacroVersion(3);
var koDoc = ko.views.manager.currentView.koDoc;
var input = koDoc.file.dirName + '/' + koDoc.file.baseName;
var barename = input.substr(0, input.length - koDoc.file.ext.length);
// Komodo Edit macro
// Bind this to F5 to run a script on press
var map = {
'.php': '/usr/local/bin/php "%F"',
'.py': 'python3 "%F"',
'.pl': 'PERL5LIB="~/perl5/lib/perl5" perl "%F"',
'.js': 'node "%F"',
'.java': 'javac -encoding UTF8 -g "%F"'
};
// var file = koDoc.file.dirName + '/' + koDoc.file.baseName;
@manhg
manhg / restview.css
Created December 8, 2014 05:56
ReST preview styling
/* Usage: put this in local webserver and use restview --css=http://127.0.0.1/restview.css file.rst */
body {
font-size: 12px;
font-family: Verdana, sans-serif;
max-width: 700px;
}
pre {
background: #f7f7f7 !important;
border: solid 1px #ccc;