Skip to content

Instantly share code, notes, and snippets.

@mhewedy
mhewedy / gist:5937773
Created July 5, 2013 23:08
How android treat private files (set rw for user/group), and world accessible (rw for user/group and w or r to others)
root@android:/data/data/com.myapps.intents/files # l
-rw-rw---- u0_a46 u0_a46 12 2013-07-05 23:02 mode_private.txt
-rw-rw--w- u0_a46 u0_a46 10 2013-07-05 23:02 mode_world.txt
@mhewedy
mhewedy / gist:6793089
Created October 2, 2013 12:43
Orders Aggregator
# Orders Aggregator
class BreadType
attr_accessor :type
def initialize(type)
@type = type
end
def eql?(other)
@type = other.type
@mhewedy
mhewedy / gist:8314090
Last active January 2, 2016 13:59
mod_create.sh Create Jboss7 modules
#! /bin/bash
if [ $# -lt 2 ]
then
echo "Usage $(basename "$0") <module name> <module jar>"
echo -e "\n(You might need to backup your files before use)"
exit 1
fi
if [ ! -d 'modules' ]; then
echo "Invalid jboss7 dir, should run from inside jboss7 dir."
@mhewedy
mhewedy / gist:8316508
Last active January 2, 2016 14:28
mod_dependency_add.sh to add dependencies to jboss7 module.xml
#! /bin/bash
if [ $# -lt 2 ]
then
echo "Usage $(basename "$0") <module name> <dependency module name>"
echo -e "\n(You might need to backup your files before use)"
exit 1
fi
if [ ! -d 'modules' ]; then
@mhewedy
mhewedy / LambdaExpr.java
Created April 21, 2014 11:11
java8 parallel sort
package helloJava8;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class LambdaExpr {
public static void main(String[] args) throws IOException {
@mhewedy
mhewedy / hasher.java
Last active August 29, 2015 14:00 — forked from sauron/hasher.rb
// direct translation for https://gist.github.com/sauron/9773864
public class Example {
public static void main(String[] args) {
System.out.println(hash("leepadg"));
System.out.println(unhash(680131659347L));
}
static String letters = "acdegilmnoprstuw";
@mhewedy
mhewedy / refactor
Last active August 29, 2015 14:01
bash file to refactor (find and replace)
#!/bin/bash
##
if [ $# -lt 2 ]
then
echo "usage $0 <old> <new>"
exit -1
fi
old=$1
@mhewedy
mhewedy / Main.java
Last active August 29, 2015 14:09
Encapsulating behaviour using functional way
import java.util.Arrays;
import java.util.List;
public class Main {
public static void main(String[] args) {
List<Integer> data = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
System.out.println("Sum of Even Numbers: "
@mhewedy
mhewedy / gist:cab070acdbff7c5941cb
Last active August 29, 2015 14:09
Using Java8
import java.util.Arrays;
import java.util.List;
public class Main {
public static void main(String[] args) {
List<Integer> data = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
System.out.println("Sum of Even Numbers: "
This file has been truncated, but you can view the full file.
Jul 28 13:49:21 localhost opendirectoryd[123]: opendirectoryd (build 382.20.2) launched - installer mode
Jul 28 13:49:21 localhost opendirectoryd[123]: Logging level limit changed to 'notice'
Jul 28 13:49:21 localhost opendirectoryd[123]: Initialize trigger support
Jul 28 13:49:21 localhost opendirectoryd[123]: created endpoint for mach service 'com.apple.private.opendirectoryd.rpc'
Jul 28 13:49:21 localhost opendirectoryd[123]: set default handler for RPC 'reset_cache'
Jul 28 13:49:21 localhost opendirectoryd[123]: set default handler for RPC 'reset_statistics'
Jul 28 13:49:21 localhost opendirectoryd[123]: set default handler for RPC 'show'
Jul 28 13:49:21 localhost opendirectoryd[123]: starting endpoint for service 'com.apple.private.opendirectoryd.rpc'
Jul 28 13:49:21 localhost configd[113]: adding com.apple.SystemConfiguration.InterfaceNamer
Jul 28 13:49:21 localhost configd[113]: adding com.apple.SystemConfiguration.SCNetworkReachability