Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am donilan on github.
  • I am doni (https://keybase.io/doni) on keybase.
  • I have a public key ASCDRtxIq0fso6gX8bwx8HEMtdTjiruO7MGIuDsCURS5Ygo

To claim this, I am signing this object:

@donilan
donilan / osx_copy_paste_with_chinese.el
Created July 31, 2017 14:45
Copy/paste with system clipboard, support Chinese or other unicode.
(defun copy-from-osx ()
(shell-command-to-string "pbpaste"))
(defun paste-to-osx (text &optional push)
(let ((process-connection-type nil)
(lang (getenv "LANG"))
(default-directory "~"))
(setenv "LANG" "en_US.UTF-8")
(let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
(process-send-string proc text)
#!/usr/bin/bash
yum install -y yum-utils
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum makecache fast
yum update -y
yum install docker-ce -y
@donilan
donilan / jail.local
Created August 4, 2016 16:30
/etc/fail2ban/jail.local
[DEFAULT]
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
# ban a host which matches an address in this list. Several addresses can be
# defined using space separator.
ignoreip = 127.0.0.1
# "bantime" is the number of seconds that a host is banned.
bantime = 3600
# A host is banned if it has generated "maxretry" during the last "findtime"
@donilan
donilan / TraceKitSupplement.js
Created July 19, 2016 05:08 — forked from devinrhode2/TraceKitSupplement.js
Stuff I've added to my error reporting/handling stuff in addition to TraceKit.js, ideally in a few months I don't write any of this code
function exceptionalException(message) {
'use strict';
if (exceptionalException.emailErrors !== false) {
exceptionalException.emailErrors = confirm('We had an error reporting an error! Please email us so we can fix it?');
}
}
//test
//exceptionalException('try 1!');
//exceptionalException('try 2!');
FROM richarvey/nginx-php-fpm
RUN usermod -u 1000 www-data
RUN groupmod -g 1000 www-data
WORKDIR /usr/share/nginx/html
@donilan
donilan / my_csv.rb
Created December 24, 2015 06:38
A ruby CSV class that extends build-in CSV and add ability that keeping original line
require 'csv'
class MyCsv < CSV
# The line of the last row read from this file.
attr_reader :line
def shift
if @_before_lineno != @lineno
@_before_pos = pos
@_before_lineno = @lineno
end