This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN server | |
# on a Ubuntu or Debian instance. Tested with Ubuntu 14.04 & 12.04 and Debian 8. | |
# With minor modifications, this script *can also be used* on dedicated servers | |
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers. | |
# | |
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! THIS IS MEANT TO BE RUN WHEN | |
# YOUR AMAZON EC2 INSTANCE STARTS! | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#encoding: utf-8 | |
# | |
'你好'.unpack('U*').each do |i| | |
print "\\u%s" % [i.to_s(16)] | |
end | |
puts '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func handler(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprint(w, "Hello, world") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// similar to Matt Aimonetti's example, read his blog! | |
// http://matt.aimonetti.net/posts/2012/11/27/real-life-concurrency-in-go/ | |
func concurrently(integers []int) []int { | |
// make a channel to talk to the goroutines | |
ch := make(chan int) | |
// prepare a slice with all the results | |
responses := []int{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
//repositories { | |
// mavenCentral() | |
// maven { | |
// url 'https://repo.eclipse.org/content/groups/releases/' | |
// } | |
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Subject: [PATCH] Fix DB linking encoding to utf8 | |
--- | |
Gemfile | 2 +- | |
Gemfile.lock | 4 ++-- | |
config/application.rb | 2 ++ | |
config/database.yml | 12 ++++++------ | |
config/environment.rb | 2 ++ | |
5 files changed, 13 insertions(+), 9 deletions(-) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CONFIG_LAST_TIME_FILE := $(srctree)/.compile.project.time | |
CONFIG_STAT_TIME:=$(if $(wildcard $(CONFIG_FILE)),$(shell stat -c %Y $(CONFIG_FILE)),) | |
TMP_CONFIG_LAST_TIME:=$(if $(wildcard $(CONFIG_LAST_TIME_FILE)),$(shell cat $(CONFIG_LAST_TIME_FILE)),) | |
# ...... | |
ifneq ("$(CONFIG_STAT_TIME)","$(TMP_CONFIG_LAST_TIME)") | |
$(warning "merge config and defaut config:") | |
OUT_CONFIG := $(srctree)/.config | |
xxx_config := $(call config.generate-auto-rules) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LdapRequest | |
HOST = 'mail.example.com' | |
PORT = 636 | |
TREEBASE='DC=example.com,DC=com' | |
ATTRS=['mail', 'department', 'telephoneNumber', 'mobile'] | |
def initialize(username, password) | |
@ldap = Net::LDAP.new :host => HOST, | |
:port => PORT, | |
:encryption => :simple_tls, | |
:auth => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo 'Error' > /abc.txt | |
echo $? #1 | |
echo 'Pass' | |
echo $? #0 | |
echo 'Pass' && echo 'Error' > /adc.txt && echo 'After Error' | |
echo $? #1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/system/xbin/busybox sh | |
PREINSTALL_RECORD_FILE=/data/system.notfirstrun | |
if [ ! -e $PREINSTALL_RECORD_FILE ]; then | |
echo "do preinstall job" | |
for i in `/system/xbin/busybox find /system/etc/property/app/ -type f -name '*.apk'`; | |
do | |
/system/bin/sh /system/bin/pm install $i | |
done | |
/system/xbin/busybox touch $PREINSTALL_RECORD_FILE | |
echo "preinstall ok" |
NewerOlder