- JS作用域有哪些,分别有什么区别?
- 说一说cookie sessionStorage localStorage 区别
- 怎么添加事件监听,有哪些方式,请分别写出
- const arr = [1, [2, [3, 4]]], 请写一个函数实现将数组arr扁平化。
- 实现一个串行的后台接口加载函数, 要求上一个接口加载完毕,再加载下一个接口
- HTTP 常用的状态码及使用场景
- HTTP 常用的请求方式,区别和用途
- 跨域有哪些解决方案?各有什么区别。
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 LockManager | |
def self.with_transaction_lock(lock_name) | |
lock_id = Zlib.crc32(lock_name.to_s) | |
ActiveRecord::Base.transaction do | |
ActiveRecord::Base.connection.execute("SELECT pg_advisory_xact_lock(#{lock_id})") | |
yield | |
end | |
end | |
def self.with_session_lock(lock_name) |
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
# Usage example: | |
# | |
# s = PinterestSpammer.new | |
# s.sign_in 'your_account_email', 'your_account_password' | |
# s.get_boards # get boards list, that contains board_id (for example - 455708124733779520) | |
# s.create_pin(455708124733779520, 'https://xyz.xyz/', 'http://rubyonrails.org/images/rails.png', 'Spammer!') | |
# | |
# | |
require 'mechanize' | |
class PinterestSpammer |
将当前目录下过去30天的目录移动指定目录下
find . -mindepth 1 -type d -mtime +30 | xargs -i mv {} /home/bu/date_30/
1.当前时间24小时—当前时间(昨天-今天)
find . -mtime 0
2.当前时间48小时前–当前时间24小时前(前天-昨天)
今天早上起来发现登录不进去vps了,然后通过vps web端将root密码重新设置, 检查/etc/passwd 文件被加入下面user REDIS0006?, Google了一下,原来是利用了redis的漏洞,由于偷懒将redis没有设置密码且以root权限运行,也没有设置只允许本地访问 (bind 127.0.0.1未打开)导致黑客可以修改/etc/passwd文件
相关文章:
- Redis后门植入分析报告(http://drops.wooyun.org/tips/10462)
- Redis 未授权访问漏洞被利用,服务器登陆不上(http://www.cnblogs.com/langdashu/p/5392128.html)
- Redis配合ssh-keygen渗透测试 (http://www.jianshu.com/p/97f4bb96612f)
vi /etc/apt/sources.list.d/pgdg.list
- 添加下面内容到文件:
deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main
- 添加签名key:
wget http://www.postgresql.org/media/keys/ACCC4CF8.asc, apt-key add ACCC4CF8.asc
- 更新源:
apt-get update
- 安装:
sudo apt-get install postgresql-9.4
- 配置验证方式:
sudo vi /etc/postgresql/9.4/main/pg_hba.conf
将peer改成md5, 然后重启:sudo service postgresql restart
- 登录数据库:
sudo -u postgres psql template1
- 创建用户名:
CREATE USER dbuser WITH PASSWORD 'password';
导出: select tag,counter into OUTFILE '/var/lib/mysql/tags.csv' FIELDS TERMINATED BY ',' FROM tag_counters ORDER BY counter desc;
导入到其它数据库: LOAD DATA INFILE '/Users/eric/Downloads/tags.csv' INTO TABLE tags FIELDS TERMINATED BY ',' (tag, counter);
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
#need replace with double quote instead of single quote | |
test_string <<EOF | |
Specifications:\n Brand: Brand new and high quality\n Style: Sexy black lace mask\n\nItem Description\n 1. Suit for all kinds of occasion like party and Halloween.\n 2. Matching your clothes well.\n\nPackage Includes\n1 x Masquerade Mask | |
EOF | |
test_string.gsub(/(\\r\\n)|\\n/, "\n") |
#####首先要激活在namecheap上购买的ssl服务
- 生成SSL证书获取CSR
bash openssl req -new -key yourdomain.pem -out yourdomain.csr
, 然后按照提示输入信息即可 - 执行cat yourdomain.csr 内容大概如下 ``` -----BEGIN CERTIFICATE REQUEST----- MIICxDCCAawCAQAwfzELMAkGA1UEBhMCQ04xEDAOBgNVBAgMB0JlaWppbmcxEDAO BgNVBAcMB0JlaWppbmcxDjAMBgNVBAoMBUJpZ2ZhMRcwFQYDVQQDDA55b3VyZG9t YWluLmNvbTEjMCEGCSqGSIb3DQEJARYUYWRtaW5AeW91cmRvbWFpbi5jb20wggEi MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9fsxThwLzCd54s2GMUcjlleCj LTf9bYGQyIjn+6z7kJbDbcrkbZxMysfRnFLa6u5oK7S9PQfGHK/gZeHfSLXbD/GL wi171tZpnQHjfLjMbHEUEUCFQD7ueek/v3/Tr+T0+em1gQt/93K2dqv7Cx+bupwc zNkQmqNgqslC4sdKQZjLUIHYLr/j8lQQLOOn9/PiuNOGCTaK5g9TA20oVCjpJZuf
NewerOlder