Skip to content

Instantly share code, notes, and snippets.

@brainv
brainv / SwiftTable
Last active August 29, 2015 14:08 — forked from jquave/SwiftTable
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
//
// AppDelegate.swift
// pushtest
//
// Created by sawapi on 2014/06/08.
// Copyright (c) 2014年 sawapi. All rights reserved.
//
// iOS8用
import UIKit

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@brainv
brainv / tmux.md
Last active August 29, 2015 14:18 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@brainv
brainv / strong_pass_helper.php
Created October 17, 2015 12:04
Strong Password helper for php / codeigniter
<?php
/**
* Password Strength Helper
* @packages Helpers
*/
/**
* Password Rules
*
* Check password for complexity and length requirements
*
@brainv
brainv / dd.log
Created October 23, 2015 07:51 — forked from ktheory/dd.log
EC2 EBS-SSD vs instance-store performance on an EBS-optimized m3.2xlarge
# /tmp/test = EBS-SSD
# /mnt/test = instance-store
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 3.26957 s, 82.1 MB/s
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test
256+0 records in
256+0 records out
@brainv
brainv / node_crypto.js
Created November 10, 2015 07:19 — forked from rojan/node_crypto.js
Encrypt in nodejs and decrypt in php or vice versa
var crypto = require('crypto');
var key = 'MySecretKey12345';
var iv = '1234567890123456';
var cipher = crypto.createCipheriv('aes-128-cbc', key, iv);
var decipher = crypto.createDecipheriv('aes-128-cbc', key, iv);
var text = 'plain text';
var encrypted = cipher.update(text, 'utf8', 'binary');
encrypted += cipher.final('binary');
hexVal = new Buffer(encrypted, 'binary');
@brainv
brainv / gist:16b1fcbfae6f675884fc
Last active February 17, 2018 01:47
SSH stop in "debug1: SSH2_MSG_KEXINIT sent"
mybaby:~ brainv$ ssh -v 192.168.255.69
OpenSSH_6.7p1 Debian-5, OpenSSL 1.0.1k 8 Jan 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.255.69 [192.168.255.69] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
#
#Example of how to use EasyMDB RS232
#Date June/2014
#Version 1.0.2
#Not warranty, for educational purposes
#Thinkchip
#V1.0.1
#dispense coin function
#Level coin changer added
@brainv
brainv / gist:76ae67b161df078ac6425e8736257d13
Created September 3, 2016 16:13 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote