/
makegit.html
158 lines (138 loc) · 12.6 KB
/
makegit.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title></title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Ubuntu" />
<link rel="stylesheet" type="text/css" href="./code/style.css"/>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2013 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="preamble" class="status">
<p><a href="index.html">top</a> | <a href="theindex.html">index</a> | <a href="sitemap.html">sitemap</a> | <a href="https://github.com/1337777/OOO1337777">edit</a></p>
</div>
<div id="content">
<div class="org-src-container">
<pre class="src src-bash"><span style="font-weight: bold; font-style: italic;">#</span><span style="font-weight: bold; font-style: italic;">!/bin/</span><span style="font-weight: bold;">bash</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">** config memo</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">:exports results :results silent < :exports code < :exports both :results silent < :exports both</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">nothing < code < code, execution < code, execution, result </span>
<span style="font-weight: bold; font-style: italic;">#</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">repoimport: .gitignore</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">theindex.inc</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">theindex.org</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">sitemap.org</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">repocache: .gitignore</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">.*</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">*.v.d</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">*.vo</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">*.vio</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">*.glob</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">*.*~</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">\#*#</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">Makefile</span>
<span style="font-weight: bold; font-style: italic;">#</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">ssh key: ~/.ssh/OOO1337777.pem</span>
<span style="font-weight: bold; font-style: italic;">#</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">apt-get install xpra</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">Xwrapper.config dpkg-reconfigure x11-common</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">allowed_users=anybody</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">cp /etc/xpra/xorg.conf .xpra/</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">cp /etc/xpra/xpra.conf .xpra/</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">/!\ MUST USE THIS WHEN IN ELEVATED PRIVILEGE, AND RUN XPRA FROM HOME DIR /!\ </span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">xvfb=Xorg -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER -auth $XAUTHORITY -config </span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">.xpra/xorg.conf </span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">cd ~ ; xpra start :37</span>
<span style="font-weight: bold; font-style: italic;">#</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">ALT SUCCESS:</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">sudo Xorg -noreset +extension GLX +extension RANDR +extension RENDER -logfile ./37.log -config ./xorg.conf :37 & disown</span>
<span style="font-weight: bold; font-style: italic;">#</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">crontab -e</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">For example, you can run a backup of all your user accounts</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">at 5 a.m every week with:</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">0 5 * * 1 tar -zcf /var/backups/home.tgz /home/</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">m h dom mon dow command</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">0-59/15 * * * * /bin/bash /home/ubuntu/OOO1337777/repocache/makegit.bash</span>
<span style="font-weight: bold; font-style: italic;">#</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">ALT SUCCESS:</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">tmux</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">while [ 1 ] ; do sleep 15m; /bin/bash /home/ubuntu/OOO1337777/repocache/makegit.bash; done</span>
<span style="font-weight: bold;">cd</span> ~/OOO1337777/repoimport ;
<span style="font-weight: bold;">if</span> (( $(<span style="font-weight: bold;">pgrep</span> --count -f <span style="font-style: italic;">'ssh-agent'</span>) <= 0 )) ; <span style="font-weight: bold;">then</span>
<span style="font-weight: bold;">eval</span> <span style="font-style: italic;">"$(</span><span style="font-weight: bold;">ssh-agent</span><span style="font-style: italic;">)"</span> ;
ssh-add ~/.ssh/ooo1337777.pem ;
<span style="font-weight: bold;">fi</span>
<span style="font-weight: bold; font-style: italic;">comm</span>=0 ;
<span style="font-weight: bold;">for</span> repo<span style="font-weight: bold;"> in</span> $( ls -1 ~/OOO1337777/repocache/.branches | sed <span style="font-style: italic;">'s/^[0-9]\+_//'</span> ) ; <span style="font-weight: bold;">do</span>
{ git pull -X ours --no-ff --no-edit ${<span style="font-weight: bold; font-style: italic;">repo</span>} <span style="font-style: italic;">\</span>
| grep -q -s <span style="font-style: italic;">'Already up-to-date\.$'</span> ; } <span style="font-style: italic;">\</span>
|| { <span style="font-weight: bold; font-style: italic;">comm</span>=$(( $<span style="font-weight: bold; font-style: italic;">comm</span> + 1 )) ;
<span style="font-weight: bold;">echo</span> ${<span style="font-weight: bold; font-style: italic;">repo</span>} >> ~/OOO1337777/repocache/.touched ; } ;
<span style="font-weight: bold;">done</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">git push --all repoexport ;</span>
<span style="font-weight: bold;">if</span> (( $<span style="font-weight: bold; font-style: italic;">comm</span> > 0 )) ; <span style="font-weight: bold;">then</span>
git push --all repoexport ;
<span style="font-weight: bold;">cd</span> ~/OOO1337777/repocache ;
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">TODO compage git log with .coqignore and erase from .coqignore the files which are touched by git log</span>
cat ./.coqignore | grep -Fve <span style="font-style: italic;">"$(</span><span style="font-weight: bold;">git</span><span style="font-style: italic;"> log -${comm} --name-only --format= | sed 's/\.\w\+$/\./' )"</span> | tee ./.coqignore 1>/dev/null ;
<span style="font-weight: bold; font-style: italic;">#</span><span style="font-weight: bold; font-style: italic;">echo -n -e "\n--8<--GIT--$( wc -l ./.touched 2>/dev/null | cut -d ' ' -f 1 )--GIT-->8--\n" ;</span>
<span style="font-weight: bold;">echo</span> -n -e <span style="font-style: italic;">"\n--8<--GIT--TOUCHES-${comm}--GIT-->8--\n"</span> ;
cat ./.touched | xargs echo ;
<span style="font-weight: bold; font-style: italic;">nowdate</span>=$(<span style="font-weight: bold;">date</span> +%s.%Y_%m_%d_%H_%M_%S) ;
cp ./.touched <span style="font-style: italic;">"./.${nowdate}.touched"</span> ;
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">crontab every 15 mins * 4 touches in queue -> more than 1h old processes</span>
<span style="font-weight: bold;">if</span> (( $(<span style="font-weight: bold;">pgrep</span> --count -f <span style="font-style: italic;">'makeemacs\.bash|makecoq\.bash'</span>) >= 5 )) ; <span style="font-weight: bold;">then</span>
pkill --oldest -f <span style="font-style: italic;">'makecoq\.bash'</span> ; pkill --oldest -f <span style="font-style: italic;">'makeemacs\.bash'</span> ;
<span style="font-weight: bold;">fi</span>
./makeemacs.bash <span style="font-style: italic;">"${nowdate}"</span> & <span style="font-weight: bold;">disown</span>
<span style="font-weight: bold;">fi</span>
<span style="font-weight: bold;">echo</span> -n -e <span style="font-style: italic;">"\n--8<--GITFINISH----GITFINISH-->8--\n"</span> ;
</pre>
</div>
</div>
</body>
</html>