Skip to content

Instantly share code, notes, and snippets.

View lajunta's full-sized avatar
🌴
On vacation

lajunta lajunta

🌴
On vacation
View GitHub Profile
@lajunta
lajunta / -
Created April 14, 2016 08:57
find latest 10 file in a directory
find /data/dbback -type f -printf "%C@ %p\n" | sort -rn | head -n 10
@lajunta
lajunta / findrestore.rb
Created April 14, 2016 11:12
find latest zip and mongorestore it
#!/usr/bin/env ruby
require "tmpdir"
dbpath = "/data/dbback"
file = `find #{dbpath} -type f -printf "%p\n" | sort -rn | head -n 1 `
Dir.mktmpdir do |dir|
`tar -C #{dir} -zxvf #{file} `
basename = File.basename(file,".gz")
rdir =dir+"/"+basename.gsub(".tar.gz","")
`mongorestore --drop --quiet #{rdir}`
end
#!/bin/sh
rsync -e 'ssh -p 22' -avz [email protected]:/data/run /data/ecbackup
sleep 1
echo "Run is backup"
echo "------------------------------------------------------------"
rsync -e 'ssh -p 22' -avz [email protected]:/etc/init/{wx,ndc,xtiku,bttrack,caddy,dljy,kpy,mongod,mongodb,qiku,tbcms,lab}.conf /data/ecbackup/upstart
sleep 1
echo "Upstart script is backup"
echo "------------------------------------------------------------"
require "restclient"
require "json"
#@keyword = URI::decode("新闻快讯")
@keyword = "学校公告"
start = '0'
lmt = '10'
@kword = @keyword.encode("GB2312","UTF-8")
kword = URI::encode(@kword)
lurl = "http://www.lwqzx.sdedu.net/kernel/net_school/active_app/login1.php"
class AppConfig{
bool is_login ;
String username;
AppConfig({this.is_login, this.username});
}
class MyApp{
static AppConfig appconfig = new AppConfig(is_login: false, username: "guest");
static updateConfig(AppConfig aconfig){
appconfig = aconfig;
}
@lajunta
lajunta / pet-snippet.toml
Created March 14, 2017 16:16
description
[[snippets]]
description = "Show all"
command = "ls -al "
@lajunta
lajunta / rortemp.rb
Created April 25, 2017 16:49
new ror template
run("rm Gemfile")
run("touch Gemfile")
add_source "https://gems.ruby-china.org/"
gem 'rails'
gem 'sass-rails'
gem 'slim-rails'
#gem 'bulma-rails'
gem 'dalli'
gem 'bson'
gem 'rucaptcha'
@lajunta
lajunta / rortemp.rb
Created April 25, 2017 16:50
new ror template
run("rm Gemfile")
run("touch Gemfile")
add_source "https://gems.ruby-china.org/"
gem 'rails'
gem 'sass-rails'
gem 'slim-rails'
#gem 'bulma-rails'
gem 'dalli'
gem 'bson'
gem 'rucaptcha'
@lajunta
lajunta / rortemp.rb
Created April 25, 2017 16:50
new ror template
run("rm Gemfile")
run("touch Gemfile")
add_source "https://gems.ruby-china.org/"
gem 'rails'
gem 'sass-rails'
gem 'slim-rails'
#gem 'bulma-rails'
gem 'dalli'
gem 'bson'
gem 'rucaptcha'
@lajunta
lajunta / rortemp.rb
Created April 25, 2017 16:50
new ror template
run("rm Gemfile")
run("touch Gemfile")
add_source "https://gems.ruby-china.org/"
gem 'rails'
gem 'sass-rails'
gem 'slim-rails'
#gem 'bulma-rails'
gem 'dalli'
gem 'bson'
gem 'rucaptcha'