Skip to content

Instantly share code, notes, and snippets.

# Functions/Macros for use when building extensions statically
# These functions also exist in CMake/HPHPIZEFunctions.cmake
# Their signatures should be kept consistent, though their behavior
# will differ slightly.
function(HHVM_LINK_LIBRARIES EXTNAME)
list(REMOVE_AT ARGV 0)
foreach (lib ${ARGV})
list(APPEND HRE_LIBRARIES ${lib})
@daohoangson
daohoangson / switch-dns-to.sh
Created March 26, 2015 01:21
Switch DNS in Mac terminal, fast and with multiple options!
#/bin/bash
NETWORK_SERVICE="Wi-Fi"
SERVERS=(google opendns uflix)
DNS_GOOGLE="8.8.8.8 8.8.4.4"
DNS_OPENDNS="208.67.222.222 208.67.220.220"
DNS_UFLIX="203.143.83.123 108.61.169.104"
if [ $# -ge 1 ]; then
# get server name in uppercase
@daohoangson
daohoangson / README.md
Last active August 29, 2015 14:25
cluster

Things that do not work:

  • MyISAM tables: xf_search_index, xf_session, xf_session_admin
@daohoangson
daohoangson / attachments.php
Last active September 26, 2015 06:10
internal_data file check
<?php
if (empty($argv[1])) {
die("\$argv[1] (\$backUpDir) is missing!\n");
}
$backUpDir = rtrim($argv[1], '/');
if (!is_dir($backUpDir)) {
die("{$backUpDir} is not a directory.");
}
@daohoangson
daohoangson / gist:2008244
Created March 9, 2012 19:32
com/android/phone/CallNotifier.java diff to enable on-call-state-changed vibration
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index 2e82543..0131c13 100755
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -160,6 +160,7 @@ public class CallNotifier extends Handler
private static final int TONE_RELATIVE_VOLUME_SIGNALINFO = 80;
private Call.State mPreviousCdmaCallState;
+ private Call.State mPreviousGsmCallState;
private boolean mVoicePrivacyState = false;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class SpellChecker {
public static String[] results;
public boolean loadRuleBase(String filename){
try{
@daohoangson
daohoangson / index.html
Created January 9, 2013 16:18
Test HTML gist
Hi!
@daohoangson
daohoangson / gist:5132085
Last active December 14, 2015 18:49
logcat filter for Android
tag:[^(Adreno200\-EGL|dalvikvm|IInputConnectionWrapper|OpenGLRenderer|SpannableStringBuilder|Trace)]
public function getFeaturedItems($nodeIds, $groupIds, $limitOption)
{
return $this->fetchAllKeyed($this->limitQueryResults(
'
SELECT thread.*, attachment.*, attachment_data.*
FROM xf_thread AS thread
LEFT JOIN xf_attachment AS attachment ON
(attachment.content_id = thread.first_post_id AND attachment.content_type = \'post\')
LEFT JOIN xf_attachment_data AS attachment_data ON
(attachment_data.data_id = attachment.data_id AND attachment_data.thumbnail_width > 0)
<?php
$arr_a = array('1','2','3','4','5','6');
$arr_b = array('apples','oranges','bananas','peaches');
function makeArray($array_a, $array_b) {
$newArr = $array_a;
foreach($array_b as $value)
{
$rand = rand(0, count($newArr) - 1);