Skip to content

Instantly share code, notes, and snippets.

@secwang
secwang / trim.sh
Created July 22, 2016 09:52
去除所有空格
#!/bin/bash
pbpaste | perl -p -e 's/\s+//g' |pbcopy
@secwang
secwang / NSScrollView.swift
Created July 24, 2016 08:15
test in PlayGround
//: Playground - noun: a place where people can play
import Cocoa
import XCPlayground
var str = "Hello, playground"
var scrollView = NSScrollView(frame: CGRectMake(0,0,80,100))
scrollView.backgroundColor = NSColor.controlColor()
import AppKit
let currentDate = NSDate()
//NSDate
//NSDateFormatter
//NSDateComponents
//NSDateComponentFormatter
//NSCalendar
//let dateComponents = NSDateComponents()
//: Playground - noun: a place where people can play
import Cocoa
import CoreData
import XCPlayground
var str = "Hello, playground"
@secwang
secwang / openssh.rb
Last active September 26, 2016 10:12
Homebrew brew formula for openssh
require 'formula'
class Openssh < Formula
homepage 'http://openssh.com/portable.html'
# url 'http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.5p1.tar.gz'
# mirror 'http://openbsd.mirrors.pair.com/OpenSSH/portable/openssh-6.5p1.tar.gz'
# sha256 'a1195ed55db945252d5a1730d4a2a2a5c1c9a6aa01ef2e5af750a962623d9027'
url 'https://github.com/steakknife/openssh.git', :tag => '6.5p1-with-6.2p2-apple-osx-109-changes-and-disable-missing-openssl-ciphers'
version '6.6p1'
@secwang
secwang / openssh.rb
Last active September 26, 2016 10:19
class Openssh < Formula
desc "OpenBSD freely-licensed SSH connectivity tools"
homepage "http://www.openssh.com/"
url "http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.6p1.tar.gz"
mirror "https://www.mirrorservice.org/pub/OpenBSD/OpenSSH/portable/openssh-6.6p1.tar.gz"
version "6.6p1"
sha256 "48c1f0664b4534875038004cc4f3555b8329c2a81c1df48db5c517800de203bb"
bottle do
sha256 "5f4212b2a550da0aac2c8b9e80a964c721e2dd0cb250ee74974c4bb7ab5ee1c9" => :el_capitan
From 105566fb27b04178cc0badda510566a8a147526e Mon Sep 17 00:00:00 2001
From: secwang <[email protected]>
Date: Tue, 13 Dec 2016 17:39:14 +0800
Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=811.6.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apollo-client/pom.xml | 2 +-
DELETE FROM mysql.user WHERE user = 'demo';
flush privileges;
GRANT ALL PRIVILEGES ON *.* TO 'demo'@'localhost' ;
GRANT ALL PRIVILEGES ON *.* TO 'demo'@'localhost' ;
CREATE USER 'demo'@'%' IDENTIFIED BY 'demo' ;
GRANT ALL PRIVILEGES ON *.* TO 'demo'@'%' WITH GRANT OPTION ;
use mysql;
update user set password=password('demo') where user='demo';
flush privileges;
exit;
set hlsearch
set smartcase
set ignorecase
set incsearch
set showcmd
" fuzzy find
set path+=**
set wildmenu
#!/usr/bin/perl
use strict;
use warnings;
my $filename = 'a.txt';
open(my $fh, '<:encoding(UTF-8)', $filename)
or die "Could not open file '$filename' $!";
while (my $row = <$fh>) {