Skip to content

Instantly share code, notes, and snippets.

🖥
Netflix and Chill

David Jiang SharkIng

🖥
Netflix and Chill
Block or report user

Report or block SharkIng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@SharkIng
SharkIng / Logcat
Created Mar 6, 2014
Android LogCat
View Logcat
03-06 00:07:53.227: D/dalvikvm(904): GC_FOR_ALLOC freed 230K, 13% free 2748K/3140K, paused 34ms, total 37ms
03-06 00:07:53.227: I/dalvikvm-heap(904): Grow heap (frag case) to 3.445MB for 635812-byte allocation
03-06 00:07:53.347: D/dalvikvm(904): GC_FOR_ALLOC freed 4K, 11% free 3364K/3764K, paused 116ms, total 116ms
03-06 00:07:53.387: D/dalvikvm(904): GC_FOR_ALLOC freed <1K, 11% free 3364K/3764K, paused 32ms, total 33ms
03-06 00:07:53.387: I/dalvikvm-heap(904): Grow heap (frag case) to 3.917MB for 500416-byte allocation
03-06 00:07:53.509: D/dalvikvm(904): GC_FOR_ALLOC freed <1K, 10% free 3852K/4256K, paused 109ms, total 109ms
03-06 00:07:53.606: E/SQLiteLog(904): (1) near "tabletasksdatabase": syntax error
03-06 00:07:53.616: D/AndroidRuntime(904): Shutting down VM
03-06 00:07:53.616: W/dalvikvm(904): threadid=1: thread exiting with uncaught exception (group=0x41465700)
03-06 00:07:53.638: E/AndroidRuntime(904): FATAL EXCEPTION: main
View gist:2b86024180b2a5e93e6a
import java.io.IOException;
import java.util.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.*;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;
public class Mappers extends Mapper<LongWritable, Text, Text, IntWritable> {
@SharkIng
SharkIng / pptp_install.sh
Created Nov 19, 2014
PPTP VPN 安装脚本
View pptp_install.sh
#!/bin/bash
type pptpd > /dev/null 2>&1
[ $? -ne 0 ] && apt-get install pptpd
grep '^localip 192.168.' /etc/pptpd.conf > /dev/null
if [ $? -ne 0 ]; then
cat >> /etc/pptpd.conf <<PPTPDCONF
localip 192.168.17.1
remoteip 192.168.17.11-60
@SharkIng
SharkIng / gencert.sh
Created Sep 28, 2015
Gen Self Sign Cert
View gencert.sh
#!/bin/sh
# create self-signed server certificate:
read -p "Enter your domain [www.example.com]: " DOMAIN
echo "Create server key..."
openssl genrsa -des3 -out $DOMAIN.key 1024
View flora_prompt.sh
git_inspect_branch() {
git branch 2> /dev/null | grep ^* | sed 's/^\* \(.*\)$/:\1/g'
}
git_inspect_added() {
[[ $(git status 2> /dev/null | grep 'Untracked files:') != '' ]] && echo '+'
}
git_inspect_modified() {
[[ $(git status 2> /dev/null | grep 'modified:') != '' ]] && echo '*'
View test1.py
# -*- coding: utf-8 -*
#########################################################################
#假设类似CTRL + A这样的组合按键算一次
#实现思路:
#首先开始直接输出A的个数必须为3,4,5中的一个,因为1和2对其做复制得不偿失,而6的时候已经相当于3个A作一次复制
#(在测试时发现使M最大的情况中直接输出5个A的情况没有出现过,但是没有找到什么理由不去考虑5个A,也许N足够大会用到5?)
#其次,输出A后需要紧接着作一次“全选复制粘贴”
#第三,再往后需要“全选复制粘贴”和单独“粘贴”做任意顺序组合,找出实现最大化的情况
#ps:这个程序在跑到N = 38的时候我的笔记本就很吃力了,所以只测试了38以下
#ps:发现规律:按键基本形式为4A(or 3A) 3 2 3 2 3 2 。。。(4A代表直接输出4个A,3代表全选复制粘贴,2代表单独两次粘贴)
View nginx.conf
# 1. Make sure you have nginx sub module compiled in
# nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module'
# 2. add two directives below at HTTP level
# nginx.conf
http {
# ......
sub_filter '</head>' '<style type="text/css">html{ filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
View README.md
View screenshot.php
<?php
if (isset($_GET['url'])) {
$url = rawurldecode(trim($_GET['url']));
if (empty($url))
return;
if (substr($url, 0, 4) != 'http')
$url = "http://{$url}";
require_once 'PHPWebDriver/__init__.php';
@SharkIng
SharkIng / gist:6590194
Created Sep 17, 2013
Error install puppet
View gist:6590194
Selecting previously unselected package pe-ruby-shadow.
Unpacking pe-ruby-shadow (from .../pe-ruby-shadow_2.2.0-1puppet3_amd64.deb) ...
Selecting previously unselected package pe-puppet.
Unpacking pe-puppet (from .../pe-puppet_3.2.4.pe1-1puppet1_all.deb) ...
Selecting previously unselected package pe-rubygem-guid.
Unpacking pe-rubygem-guid (from .../pe-rubygem-guid_0.1.1-1puppet2_all.deb) ...
Selecting previously unselected package pe-rubygem-builder.
Unpacking pe-rubygem-builder (from .../pe-rubygem-builder_3.0.0-1puppet2_all.deb) ...
Selecting previously unselected package pe-rubygem-excon.
Unpacking pe-rubygem-excon (from .../pe-rubygem-excon_0.14.1-1puppet2_all.deb) ...
You can’t perform that action at this time.