This file contains hidden or 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
| # | |
| # Powershell script for adding/removing/showing entries to the hosts file. | |
| # | |
| # Known limitations: | |
| # - does not handle entries with comments afterwards ("<ip> <host> # comment") | |
| # | |
| $file = "C:\Windows\System32\drivers\etc\hosts" | |
| function add-host([string]$filename, [string]$ip, [string]$hostname) { |
This file contains hidden or 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
| var mongo = require('mongodb'), | |
| EventEmitter = require('events').EventEmitter; | |
| function Connector(settings) { | |
| settings.port = settings.port || mongo.Connection.DEFAULT_PORT; | |
| this.settings = settings; | |
| this.server = new mongo.Server(settings.host, settings.port); | |
| this.db = new mongo.Db(settings.database, this.server, {native_parser: true}); | |
| } |
This file contains hidden or 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 | |
| mkdir ~/down/ | |
| cd ~/down/ | |
| sudo apt-get install build-essential | |
| wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz | |
| tar -xzf Python-2.7.2.tgz | |
| cd Python-2.7.2 | |
| sudo apt-get install libsqlite3-dev zlib1g-dev libncurses5-dev | |
| sudo apt-get install libgdbm-dev libbz2-dev libreadline5-dev | |
| sudo apt-get install libssl-dev libdb-dev |
This file contains hidden or 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
| <# | |
| .SYNOPSIS | |
| Converts files to the given encoding. | |
| Matches the include pattern recursively under the given path. | |
| .EXAMPLE | |
| Convert-FileEncoding -Include *.js -Path scripts -Encoding UTF8 | |
| #> | |
| function Convert-FileEncoding([string]$Include, [string]$Path, [string]$Encoding='UTF8') { | |
| $count = 0 |
This file contains hidden or 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 | |
| # add a simple 'nuget' command to Mac OS X under Mono | |
| # get NuGet.exe binary from http://nuget.codeplex.com/releases/view/58939 | |
| # get Microsoft.Build.dll from a Windows .NET 4.0 installation | |
| # copy to /usr/local/bin and Robert is your father's brother.... | |
| # | |
| PATH=/usr/local/bin:$PATH | |
| mono --runtime=v4.0 /usr/local/bin/NuGet.exe $* |
This file contains hidden or 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
| var app = angular.module('plunker', []); | |
| app.controller('MainCtrl', function($scope, $timeout) { | |
| $scope.save = function(){ | |
| $scope.loading = true; | |
| $timeout(function(){ | |
| $scope.loading = false; | |
| }, 3000); | |
| }; |
This file contains hidden or 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 | |
| # Size at the end is * 2048 where 2048 = 1 MB, so 1572864 = 768 MB | |
| #DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://1572864` | |
| DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://2097152` | |
| /usr/sbin/diskutil erasevolume HFS+ "RamDiskCache" $DISK | |
| CACHEDIR="/Volumes/RamDiskCache/$USER" |
This file contains hidden or 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
| git diff -z --name-only --diff-filter=ACMRTUB `git merge-base HEAD master` | xargs -0 eslint |
This file contains hidden or 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 bash | |
| set -e | |
| # allow being run from somewhere other than the git rootdir | |
| gitroot=$(git rev-parse --show-cdup) | |
| # default gitroot to . if we're already at the rootdir | |
| gitroot=${gitroot:-.}; | |
| nm_bin=$gitroot/node_modules/.bin |
This file contains hidden or 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
| <?php | |
| //淘客长(短)网址提取商品id | |
| //unescape 转码 | |
| function unescape($str) { | |
| $ret = ''; | |
| $len = strlen($str); | |
| for ($i = 0; $i < $len; $i ++) | |
| { | |
| if ($str[$i] == '%' && $str[$i + 1] == 'u') | |
| { |
OlderNewer