Skip to content

Instantly share code, notes, and snippets.

View faisalburhanudin's full-sized avatar
❤️

faisal burhanudin faisalburhanudin

❤️
View GitHub Profile
@faisalburhanudin
faisalburhanudin / Vbox vdi resize
Created January 5, 2015 04:49
VBox Virtual Harddisk Resize
VBoxManage modifyhd <uuid> --resize <size in MB>
If it's an entire DB, then:
$ mysqldump -u [uname] -p[pass] db_name > db_backup.sql
If it's all DBs, then:
$ mysqldump -u [uname] -p[pass] --all-databases > all_db_backup.sql
If it's specific tables within a DB, then:
@faisalburhanudin
faisalburhanudin / jquery-slug.js
Last active August 29, 2015 14:15
generate slug with javascript, on typing
$("#name").keyup(function(){
var Text = $(this).val();
$("#slug").val(function(){
return Text
.toLowerCase()
.replace(/[^\w ]+/g,'')
.replace(/ +/g,'-')
;
});
});
@faisalburhanudin
faisalburhanudin / es.json
Created July 29, 2015 09:48
elasticsearch search with list and another fields
{
"query" : {
"filtered" : {
"filter" : {
"bool" : {
"must" : [
{ "terms" : {
"user_id" : [1, 2, 3,4 ,5]
}},
{ "term": { "post_text" : "aku" }}
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/api', methods = ['GET'])
def this_func():
"""This is a function. It does nothing."""
return jsonify({ 'result': '' })
@app.route('/api/help', methods = ['GET'])
  1. Delete the relevant section from the .gitmodules file.
  2. Stage the .gitmodules changes git add .gitmodules
  3. Delete the relevant section from .git/config.
  4. Run git rm --cached path_to_submodule (no trailing slash).
  5. Run rm -rf .git/modules/path_to_submodule
  6. Commit git commit -m "Removed submodule <name>"
  7. Delete the now untracked submodule files rm -rf path_to_submodule
@faisalburhanudin
faisalburhanudin / path.py
Last active July 13, 2016 22:34
file path python
# Get current dir
import os
os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
# or
os.path.dirname(os.path.abspath(__name__))
# or
os.getcwd()
// Example httptest using gin framework
package gomir
import (
"testing"
"net/http/httptest"
"net/http"
"github.com/stretchr/testify/assert"
)
# built-in twisted getPage return deferred
# but i want to get response_headers
# this funct MyGetPage return HTTPClientFactory object
# instead of deferred
# so after callback we can get headers
from twisted.internet import reactor
from twisted.python.compat import nativeString
from twisted.web.client import URI, HTTPClientFactory
string_tipe = ", ".join('"%s"' % i for i in split_tipe)