Browse Source

lazy update

John ShaggyTwoDope Jenkins 4 years ago
parent
commit
22cfff1de8
2 changed files with 409 additions and 0 deletions
  1. 396
    0
      hashbang.sh
  2. 13
    0
      podcastsdl

+ 396
- 0
hashbang.sh View File

@@ -0,0 +1,396 @@
1
+-----BEGIN PGP SIGNED MESSAGE-----
2
+Hash: SHA256
3
+
4
+#!/bin/sh
5
+<<\EOF
6
+<!--
7
+  Hey, you found the source code!
8
+
9
+  That is a sign you hopefully know better than to blindly run unknown commands
10
+  from the internet and/or are a curious person. We like you already.
11
+
12
+  What this command will actually do, is set you up with a free "shell" account
13
+  on one of our servers, that you can use as you see fit. It will also set you
14
+  up with email, IRC, and other things on your shell, so you can keep in touch
15
+  and learn/make awesome things with us.
16
+
17
+  Don't trust us? Good! You probably don't know us (yet) so you shouldn't.
18
+
19
+  To help address this we GPG sign this shell-setup script so you can verify
20
+  it has not been changed by a third party before you run it by doing:
21
+
22
+  > gpg --verify <(curl https://hashbang.sh)
23
+
24
+  The safest method of running a script from a source you don't trust is to:
25
+
26
+  Download locally over SSL
27
+  > curl https://hashbang.sh >> hashbang.sh
28
+
29
+  Verify integrty with GPG (If available)
30
+  > gpg --recv-keys 0xD2C4C74D8FAA96F5
31
+  > gpg --verify hashbang.sh
32
+
33
+  Inspect source code
34
+  > less hashbang.sh
35
+
36
+  Run
37
+  > chmod +x hashbang.sh
38
+  > ./hashbang.sh
39
+
40
+  As an advanced alternative you can bypass using this script and hit our user
41
+  provisioning API directly with an SSH Public Key and desired username:
42
+
43
+  > curl -d '{"user":"someuser","key":"'"$(cat ~/.ssh/id_rsa.pub)"'"}' -H 'Content-Type: application/json' https://hashbang.sh/user/create
44
+
45
+  We look forward to seeing you on the other side.
46
+
47
+- -->
48
+<!DOCTYPE html>
49
+<html lang="en">
50
+  <head>
51
+    <title>&lrm;</title>
52
+    <meta name="viewport" content="initial-scale = 1, maximum-scale=1, user-scalable = 0"/>
53
+    <meta name="apple-mobile-web-app-capable" content="yes"/>
54
+    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
55
+    <meta name="HandheldFriendly" content="true"/>
56
+    <meta name="MobileOptimized" content="320"/>
57
+    <link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
58
+    <style type="text/css">
59
+        * {
60
+        text-indent:-9999px;
61
+        -webkit-touch-callout: none;
62
+        -webkit-user-select: none;
63
+        -khtml-user-select: none;
64
+        -moz-user-select: none;
65
+        -ms-user-select: none;
66
+        user-select: none;
67
+      }
68
+      html {
69
+        background:black;
70
+        color:black;
71
+      }
72
+      body {
73
+        display:block;
74
+        position:fixed;
75
+        top:50%;
76
+        left:50%;
77
+        margin-top:-160px;
78
+        margin-left:-160px;
79
+        width:320px;
80
+        height:320px;
81
+        color:#DDD;
82
+        overflow:hidden;
83
+      }
84
+      h1 {
85
+        text-indent:0px;
86
+        font-family: 'Montserrat', cursive;
87
+        position:absolute;
88
+        top:-50px;
89
+        left:10px;
90
+        right:0px;
91
+        line-height:0px;
92
+        font-size:280px;
93
+      }
94
+      a {
95
+        color:white;
96
+        text-decoration:none;
97
+      }
98
+      code {
99
+        text-indent:0px;
100
+        display:block;
101
+        position:absolute;
102
+        bottom:0px;
103
+        left:0px;
104
+        right:0px;
105
+        text-align:center;
106
+        font-size:20px;
107
+      }
108
+    </style>
109
+  </head>
110
+  <body>
111
+    <script>
112
+      window.location="#!"
113
+      var link = document.createElement("link");
114
+      link.type = "image/png";
115
+      link.rel = "icon";
116
+      link.href = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQAAAAA3iMLMAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAd2KE6QAAAAYSURBVAjXY2CAAck+EKp/B0II9gMoGwYA4+MJkeae/NUAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTQtMDUtMTdUMTM6MzI6MTMtMDQ6MDB7pieOAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE0LTA1LTE3VDEzOjMxOjQ4LTA0OjAwqyt+rwAAAABJRU5ErkJggg==";
117
+      document.getElementsByTagName("head")[0].appendChild(link);
118
+    </script>
119
+    <h1>#!</h1>
120
+    <a href="view-source:https://hashbang.sh"><code>sh <(curl hashbang.sh)</code></a>
121
+  </body>
122
+</html>
123
+<!--
124
+EOF
125
+#!/bin/sh
126
+# This script first and foremost attempts to be POSIX compliant.
127
+# Secondly, it attempts to be compatible with as many shell implementations as
128
+# possible to provide an easy gateway for new users.
129
+
130
+# If we're using bash, we do this
131
+if [ "x$BASH" != "x" ]; then
132
+	shopt -s extglob
133
+	set -o posix
134
+fi
135
+
136
+checkutil() {
137
+	printf " * Checking for $1..."
138
+	which $1 >/dev/null
139
+	if [ $? -eq 0 ]; then
140
+		printf "ok!\n";
141
+		return 0;
142
+	else
143
+		printf "not found!"
144
+		return 1
145
+	fi
146
+}
147
+
148
+# This function can be called with two parameters:
149
+#
150
+# First is obligatory, and is the "question posed".
151
+# For instance, one may ask "is pizza your favorite meal?", to which the
152
+# responder may answer Y (yes) or N (no).
153
+#
154
+# Second parameter is optional, and can be either Y or N.
155
+# The reasoning behind this is to have a default answer to the question,
156
+# resulting in the responder being able to simple press [enter] and skip
157
+# pressing Y or N, giving the default answer instead.
158
+ask() {
159
+    while true; do
160
+			prompt=""
161
+			default=""
162
+
163
+        if [ "${2}" = "Y" ]; then
164
+            prompt="Y/n"
165
+            default=Y
166
+        elif [ "${2}" = "N" ]; then
167
+            prompt="y/N"
168
+            default=N
169
+        else
170
+            prompt="y/n"
171
+            default=
172
+        fi
173
+
174
+        # Ask the question
175
+				printf "%s [%s] " "$1" "$prompt"
176
+        read REPLY
177
+
178
+        # Default?
179
+        if [ -z "$REPLY" ]; then
180
+            REPLY=$default
181
+        fi
182
+
183
+        # Check if the reply is valid
184
+        case "$REPLY" in
185
+            Y*|y*) return 0 ;;
186
+            N*|n*) return 1 ;;
187
+        esac
188
+
189
+    done
190
+}
191
+
192
+clear;
193
+echo "   _  _    __  ";
194
+echo " _| || |_ |  |  Welcome to #!. This network has three rules:";
195
+echo "|_  __  _||  | ";
196
+echo " _| || |_ |  |  1. When people need help, teach. Don't do it for them";
197
+echo "|_  __  _||__|  2. Don't use our resources for closed source projects";
198
+echo "  |_||_|  (__)  3. Be excellent to each other";
199
+echo "               ";
200
+echo " We are a diverse community of people who love teaching, and learning.";
201
+echo " Putting a #! at the beginning of a \"script\" style program tells a ";
202
+echo " computer that it needs to \"do something\" or \"execute\" this file.";
203
+echo " Likewise, we are a community of people that like to \"do stuff\".";
204
+echo " ";
205
+echo " If you like technology, and you want to learn to write your first";
206
+echo " program, learn to use Linux, or even take on interesting challenges";
207
+echo " with some of the best in the industry, you are in the right place.";
208
+echo "";
209
+echo " The following will set you up with a \"shell\" account on one of our";
210
+echo " shared systems. From here you can run IRC chat clients to talk to us,";
211
+echo " access to personal file storage and web hosting, and a wide range of";
212
+echo " development tools. ";
213
+echo " ";
214
+echo " Everything should work perfectly, unless it doesn't";
215
+echo " ";
216
+echo " Please report any issues here: ";
217
+echo "   -> https://github.com/hashbang/hashbang.sh/issues/";
218
+echo " ";
219
+printf " If you agree with the above and wish to continue, hit [Enter] ";
220
+read _
221
+clear
222
+
223
+echo " ";
224
+echo " ";
225
+echo " -------------------------------------------------------------------- ";
226
+echo " ";
227
+
228
+echo " First, your system must be properly configured with the required";
229
+echo " utilities and executables.";
230
+echo " We will perform a short check for those now.";
231
+echo " NOTE: If you see this message, it is likely because something is";
232
+echo " not installed. Check the list below, and install any";
233
+echo " missing applications.";
234
+
235
+checkutil expr || exit 1
236
+( checkutil ssh-keygen && checkutil ssh ) || exit 1
237
+( checkutil curl || checkutil busybox ) || exit 1
238
+
239
+clear;
240
+
241
+echo " ";
242
+echo " ";
243
+echo " -------------------------------------------------------------------- ";
244
+echo " ";
245
+
246
+
247
+echo " To create your account we first need a username.";
248
+echo " ";
249
+echo " A valid username must:";
250
+echo "  * be between between 1-31 characters long";
251
+echo "  * consist of only 0-9 and a-z (lowercase only)";
252
+echo "  * begin with a letter";
253
+echo " ";
254
+echo " Traditional unix usernames are first initial, optional middle initial,";
255
+echo " and the first 6 characters of the last name, but feel free to use ";
256
+echo " whatever you want";
257
+echo " ";
258
+
259
+while [ "x$username" = "x" ]; do
260
+    printf " Username: ";
261
+    read input;
262
+    if echo "$input" | grep -E "^[a-z][a-z0-9]{0,30}$" >/dev/null; then
263
+        username=$input
264
+    else
265
+        echo " ";
266
+        echo " \"$input\" is not a valid username."
267
+        echo " Please read the instructions and try again"
268
+        echo " ";
269
+    fi
270
+done
271
+
272
+echo " ";
273
+echo " -------------------------------------------------------------------- ";
274
+echo " ";
275
+echo " Now we will need an SSH Public Key."
276
+echo " ";
277
+echo " SSH Keys are a type of public/private key system that let you identify ";
278
+echo " yourself to systems like this one without ever sending your password ";
279
+echo " over the internet, and thus by nature we won't even know what it is";
280
+echo " ";
281
+
282
+for keytype in id_rsa id_dsa id_ecdsa id_ed25519; do
283
+    if [ -e ~/.ssh/$keytype.pub  ]; then
284
+        if ask " We found a public key in [ ~/.ssh/$keytype.pub ]. Use this key?" Y; then
285
+            keyfile="~/.ssh/$keytype.pub"
286
+            key=$(cat ~/.ssh/$keytype.pub)
287
+            break
288
+        fi
289
+    fi
290
+done
291
+
292
+if [ "x$key" = "x" ]; then
293
+    if ask " Do you want us to generate a key for you?" Y; then
294
+        ssh-keygen -t rsa -C "#! $username"
295
+        keyfile="~/.ssh/id_rsa.pub"
296
+        key=$(cat ~/.ssh/id_rsa.pub)
297
+    fi
298
+fi
299
+
300
+
301
+
302
+while [ "x$key" = "x" ]; do
303
+    echo " ";
304
+    echo " Please enter path to SSH Public Key: ";
305
+    read keyfile
306
+    if [ -f $keyfile ] ; then
307
+        ssh-keygen -l -f $keyfile > /dev/null 2>&1
308
+        if [ $? -eq 0 ]; then
309
+            key=$(cat $keyfile)
310
+        else
311
+            echo " ";
312
+            echo " \"$keyfile\" is not a valid SSH Public Key";
313
+        fi
314
+    else
315
+       echo " ";
316
+       echo " \"$keyfile\" does not exist";
317
+    fi
318
+done
319
+
320
+# Insert functions to allow user to select from multiple hosts here
321
+# hardcoding all users to va1 for now
322
+host="va1"
323
+
324
+if [ "x$key" != "x" -a "x$username" != "x" ]; then
325
+    echo " ";
326
+    echo " -------------------------------------------------------------------- ";
327
+    echo " ";
328
+    echo " We are going to create an account with the following information";
329
+    echo " ";
330
+    echo " Username: $username";
331
+    echo " Public Key: $keyfile";
332
+    echo " Host: $host";
333
+    echo " ";
334
+    if ask " Does this look correct?" Y ; then
335
+        echo " ";
336
+        echo " Creating your account...";
337
+        echo " ";
338
+
339
+	if curl -f -H "Content-Type: application/json" \
340
+        -d "{\"user\":\"$username\",\"key\":\"$key\",\"host\":\"$host\"}" \
341
+        https://hashbang.sh/user/create; then
342
+            echo " ";
343
+            echo " Account Created!"
344
+            echo " ";
345
+        else
346
+            echo " ";
347
+            echo " Account creation failed.";
348
+            echo " Something went awfully wrong and we couldn't create an account for you.";
349
+            echo " If you think this is a bug, please report it to ";
350
+            echo " -> https://github.com/hashbang/hashbang.sh/issues/";
351
+            echo " ";
352
+            echo " The installer will not continue from here...";
353
+            echo " ";
354
+            exit 1
355
+        fi
356
+
357
+        if ask " Would you like an alias (shortcut) added to your .ssh/config?" Y ; then
358
+            printf "\nHost hashbang\n  HostName ${host}.hashbang.sh\n  User %s\n  IdentityFile %s\n" \
359
+							"$username" "$keyfile" \
360
+            >> ~/.ssh/config
361
+            echo " You can now connect any time by entering the command:";
362
+            echo " ";
363
+            echo " > ssh hashbang";
364
+        else
365
+            echo " You can now connect any time by entering the command:";
366
+            echo " ";
367
+            echo " > ssh ${username}@${host}.hashbang.sh";
368
+        fi
369
+
370
+        echo " ";
371
+    fi
372
+
373
+    if ask " Do you want us to log you in now?" Y; then
374
+        ssh ${username}@${host}.hashbang.sh
375
+    fi
376
+fi
377
+# exit [n]. if [n] is not specified, then exit shall use the return code of the
378
+# last command.
379
+exit 0
380
+-----BEGIN PGP SIGNATURE-----
381
+Version: GnuPG v2
382
+
383
+iQIcBAEBCAAGBQJVBUEaAAoJENLEx02Pqpb1t8MQAILYt9PTMyWC5rqd9E78eCA6
384
+wlv/LLDdbNdLfSyWxGZCQbPzxmb1q0rgQdstm111samUvqQWbHNEVnjI8Ms4AmaI
385
+SmYXgF3e491rWGtf6DBhcoGAHrr1ClmdJHUqgyamdd++mHrWLjSh+WtzbsHrRPTy
386
+xZ2egiJKVydFktsSxQvDk4ruZaRfBDwmSuZ/JGK60oIb5U8dWN3LV9R6gAucAVNp
387
+TsDqJajh9yl/vaB5ebhFrzJaWmSUT/FEU5Ulv48AGJjmSonGZR3fCICaVoKTAqhM
388
+5SMjD4d9CChKRg3K1JV+SgWBydj59bPMiw2+7tu4RU6S6o+tsTQlMs26E/qwZ7qT
389
+aN65KXVvZX9YGTxjo4V/qAQWlcWHgzJFmzHiQrDv2BUYKU822pJ/d88oGo7I13ZG
390
+DeMXexnKp66W6Bl591zDYqlTGiF8NpZrp7VE2SpkT0BqnuKtN81KVGCYgwA4TOf7
391
+VlEuJRb/Plz1sWcNB9CpYxS/gh886l2lEIa20T+YYu+6Bos9olcR3HA6RiEHC2FE
392
+Fk2z7b67ocprWp9euiMMEBL0/Cx9jBdDdyhM8MQ75YImRKwTnPHdpq5CcJJ5Quwx
393
+c13aIemWlgQU30hQmISiKsU70q0Z+ax3GmdSsdfXRiyRIlqGAbS+GPU9xatp44JA
394
+WxDkrEseYOPiDRlzEh3K
395
+=OvXQ
396
+-----END PGP SIGNATURE-----

+ 13
- 0
podcastsdl View File

@@ -0,0 +1,13 @@
1
+#!/usr/bin/env bash
2
+# AUTHOR:   shaggy
3
+# FILE:     podcastsdl
4
+# ROLE:     TODO (some explanation)
5
+# CREATED:  2015-03-11 09:32:56
6
+# MODIFIED: 2015-03-17 14:10:07
7
+
8
+
9
+
10
+cd /riddlebox/Music/Podcasts
11
+gawk '{ print $1 }' /home/shaggy/.newsbeuter/queue > /home/shaggy/.newsbeuter/urls-down
12
+wget -nv -i /home/shaggy/.newsbeuter/urls-down
13
+cat /home/shaggy/.newsbeuter/blankfile > /home/shaggy/.newsbeuter/queue

Loading…
Cancel
Save