~chipaca/unity-lens-video/custom-user-agent

« back to all changes in this revision

Viewing changes to main/fixtures/OneLiner.json

  • Committer: Janos Gyerik
  • Date: 2012-02-05 07:25:51 UTC
  • Revision ID: janos@axiom-20120205072551-g3lmm6ktrk4kjphj
removed main/fixtures and will ignore them in the future

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
[
2
 
    {
3
 
        "pk": 1, 
4
 
        "model": "main.oneliner", 
5
 
        "fields": {
6
 
            "limitations": "", 
7
 
            "explanation": "When you watch a flash video like youtube in a browser, the video file is saved on your harddisk at a temporary location. And, if you watch a video and then another video in the same window, the first one will be deleted.", 
8
 
            "summary": "Find Flash videos stored by browsers on a Mac", 
9
 
            "created_dt": "2011-08-05 18:57:10", 
10
 
            "user": 2, 
11
 
            "line": "find /private/ 2>/dev/null | grep /Flash", 
12
 
            "is_published": true
13
 
        }
14
 
    }, 
15
 
    {
16
 
        "pk": 2, 
17
 
        "model": "main.oneliner", 
18
 
        "fields": {
19
 
            "limitations": "- Won't work if there are spaces in a filename.", 
20
 
            "explanation": "- {{<(cmd)}} is the filename of a named pipe (FIFO), where the named pipe is filled by the output of {{cmd}}\r\n- {{paste}} puts together the named pipes to form two columns: first column with the original filenames, second column with the lowercased filenames\r\n- {{... | tr abc ABC}} transforms stdin by replacing any characters that appear in the first set of letters to the second set of letters\r\n- {{while read old new; do ...; done}} for each line it reads the first column into {{$old}} and the second column into {{$new}}", 
21
 
            "summary": "An elegant way to rename all files in a directory to lowercase names", 
22
 
            "created_dt": "2011-08-05 18:57:10", 
23
 
            "user": 2, 
24
 
            "line": "paste <(ls) <(ls | tr A-Z a-z) | while read old new; do echo mv -v $old $new; done\r\n", 
25
 
            "is_published": true
26
 
        }
27
 
    }, 
28
 
    {
29
 
        "pk": 3, 
30
 
        "model": "main.oneliner", 
31
 
        "fields": {
32
 
            "limitations": "- The author information will get lost in the process.\r\n", 
33
 
            "explanation": "- The commit history in repo1 will be copied to repo2.\r\n- The temporary Bazaar repository (proj1) will have the full history of changes.", 
34
 
            "summary": "Mirror a Subversion repository from one Subversion repository to another Subversion repository", 
35
 
            "created_dt": "2011-08-05 18:57:10", 
36
 
            "user": 2, 
37
 
            "line": "bzr co https://repo1/proj1/trunk proj1 && cd proj1 && bzr push https://repo2/vendor/proj1/trunk\r\ncd proj1 && bzr up && bzr push", 
38
 
            "is_published": true
39
 
        }
40
 
    }, 
41
 
    {
42
 
        "pk": 4, 
43
 
        "model": "main.oneliner", 
44
 
        "fields": {
45
 
            "limitations": "", 
46
 
            "explanation": "Replace {{/dev/sdd1}} with whatever your USB stick is mounted on.", 
47
 
            "summary": "Change the label of a USB drive in Linux without a gui", 
48
 
            "created_dt": "2011-08-05 18:57:10", 
49
 
            "user": 2, 
50
 
            "line": "sudo mlabel -i /dev/sdd1 ::NewLabel", 
51
 
            "is_published": true
52
 
        }
53
 
    }, 
54
 
    {
55
 
        "pk": 5, 
56
 
        "model": "main.oneliner", 
57
 
        "fields": {
58
 
            "limitations": "", 
59
 
            "explanation": "In Ubuntu the first user (created during installation) has special privileges. The privileges come from the fact that the user was automatically added to various system groups. To make another user have the same privileges, all you need to do is add the user to the same groups.\r\n\r\n- {{grep :boss /etc/group}} gets the group records where the user {{boss}} is the first member. \r\n- {{cut -f1 -d:}} gets the first column, where \":\" is the column separator.\r\n- {{for i in ...; do ... ; done}} for each group it adds the user to the group.", 
60
 
            "summary": "Make another user superuser in Ubuntu", 
61
 
            "created_dt": "2011-08-05 18:57:10", 
62
 
            "user": 2, 
63
 
            "line": "for i in $(grep :boss /etc/group | cut -f1 -d:); do adduser wife $i; done", 
64
 
            "is_published": true
65
 
        }
66
 
    }, 
67
 
    {
68
 
        "pk": 6, 
69
 
        "model": "main.oneliner", 
70
 
        "fields": {
71
 
            "limitations": "", 
72
 
            "explanation": "todo", 
73
 
            "summary": "todo - smartctl", 
74
 
            "created_dt": "2011-08-05 18:57:10", 
75
 
            "user": 2, 
76
 
            "line": "smartctl -t long /dev/sda\r\nsmartctl -a /dev/sda", 
77
 
            "is_published": false
78
 
        }
79
 
    }, 
80
 
    {
81
 
        "pk": 9, 
82
 
        "model": "main.oneliner", 
83
 
        "fields": {
84
 
            "limitations": "", 
85
 
            "explanation": "todo", 
86
 
            "summary": "todo - cpio", 
87
 
            "created_dt": "2011-08-05 18:57:10", 
88
 
            "user": 2, 
89
 
            "line": "find . -xdev -print0 | cpio -oa0V | gzip > path_to_save.cpio.gz\r\ngzip -cd path_to_save.cpio.gz | cpio -imV", 
90
 
            "is_published": false
91
 
        }
92
 
    }, 
93
 
    {
94
 
        "pk": 11, 
95
 
        "model": "main.oneliner", 
96
 
        "fields": {
97
 
            "limitations": "", 
98
 
            "explanation": "", 
99
 
            "summary": "Create an encrypted tar file with openssl", 
100
 
            "created_dt": "2011-08-08 23:30:33", 
101
 
            "user": 2, 
102
 
            "line": "tar c paths_to_files_and_dirs | gzip -c | openssl des3 > encrypted.tar.gz\r\nopenssl des3 -d < encrypted.tar.gz | tar zx", 
103
 
            "is_published": true
104
 
        }
105
 
    }, 
106
 
    {
107
 
        "pk": 12, 
108
 
        "model": "main.oneliner", 
109
 
        "fields": {
110
 
            "limitations": "", 
111
 
            "explanation": "", 
112
 
            "summary": "Change to the previous directory, a shortcut for \"cd $OLDPWD\"", 
113
 
            "created_dt": "2011-08-08 23:31:34", 
114
 
            "user": 2, 
115
 
            "line": "cd -", 
116
 
            "is_published": true
117
 
        }
118
 
    }, 
119
 
    {
120
 
        "pk": 13, 
121
 
        "model": "main.oneliner", 
122
 
        "fields": {
123
 
            "limitations": "", 
124
 
            "explanation": "- {{echo 1 > /proc/sys/kernel/sysrq}} enable the sysrq interface\r\n- {{echo o > /proc/sysrq-trigger}} halts\r\n- {{echo b > /proc/sysrq-trigger}} reboots", 
125
 
            "summary": "Halt the system in Linux without the halt command or gui", 
126
 
            "created_dt": "2011-08-09 19:55:50", 
127
 
            "user": 2, 
128
 
            "line": "echo 1 > /proc/sys/kernel/sysrq\r\necho o > /proc/sysrq-trigger", 
129
 
            "is_published": true
130
 
        }
131
 
    }, 
132
 
    {
133
 
        "pk": 14, 
134
 
        "model": "main.oneliner", 
135
 
        "fields": {
136
 
            "limitations": "", 
137
 
            "explanation": "", 
138
 
            "summary": "Convert all flac files in the current directory to mp3 format using \"lame\"", 
139
 
            "created_dt": "2011-08-09 19:57:06", 
140
 
            "user": 2, 
141
 
            "line": "for i in *.flac; do flac -c -d \"$i\" | lame -m j -b 192 -s 44.1 - \"${i%.flac}.mp3\"; done", 
142
 
            "is_published": true
143
 
        }
144
 
    }, 
145
 
    {
146
 
        "pk": 15, 
147
 
        "model": "main.oneliner", 
148
 
        "fields": {
149
 
            "limitations": "", 
150
 
            "explanation": "Useful if you have a directory full of data to burn to DVD without using a GUI. ", 
151
 
            "summary": "Burn the contents of a directory to dvd without a gui", 
152
 
            "created_dt": "2011-08-14 19:35:52", 
153
 
            "user": 2, 
154
 
            "line": "sudo apt-get install dvd+rw-tools\r\ngrowisofs -dvd-compat -Z /dev/scd0 -R -J -pad path_to_dir", 
155
 
            "is_published": true
156
 
        }
157
 
    }, 
158
 
    {
159
 
        "pk": 16, 
160
 
        "model": "main.oneliner", 
161
 
        "fields": {
162
 
            "limitations": "", 
163
 
            "explanation": "When downloading web pages with wget, some websites try to be smart and detect your preferred language based on geographical location of your IP address. This can be a problem if for example you are in Japan but you want to download a page in English.", 
164
 
            "summary": "Force the preferred language when downloading a web page with wget", 
165
 
            "created_dt": "2011-08-21 11:40:12", 
166
 
            "user": 2, 
167
 
            "line": "wget -\u2013header=\u2019Accept-Language: en-us\u2019 http://www.timeanddate.com/calendar/index.html?year=2008&country=26 -O calendar.html", 
168
 
            "is_published": true
169
 
        }
170
 
    }, 
171
 
    {
172
 
        "pk": 17, 
173
 
        "model": "main.oneliner", 
174
 
        "fields": {
175
 
            "limitations": "", 
176
 
            "explanation": "Recent versions of the flash plugin hide the temporary file by marking it deleted. Practically the video stream is downloaded to a \"deleted file\". However, even when a file is deleted, if the file is opened by a process then you can find its file descriptor and consequently the file contents. \r\n\r\nThis simple script prints out the file descriptors of opened Flash videos:\r\n\r\n    {{file /proc/*/fd/* 2>/dev/null | grep Flash | cut -f1 -d:}}\r\n\r\nAnd, you probably want to create a regular file from the file descriptor, for example:\r\n\r\n    {{cp $(file /proc/*/fd/* 2>/dev/null | grep Flash | cut -f1 -d: | head -n 1) video.avi}}\r\n\r\nOtherwise the file descriptor is not very convenient (remember, it's a deleted file!)\r\n\r\nThe method should work regardless of your browser.\r\n", 
177
 
            "summary": "Find video files cached by the flash plugin in browsers", 
178
 
            "created_dt": "2011-08-27 11:46:46", 
179
 
            "user": 2, 
180
 
            "line": "file /proc/*/fd/* 2>/dev/null | grep Flash | cut -f1 -d:", 
181
 
            "is_published": true
182
 
        }
183
 
    }, 
184
 
    {
185
 
        "pk": 18, 
186
 
        "model": "main.oneliner", 
187
 
        "fields": {
188
 
            "limitations": "", 
189
 
            "explanation": "With screen you can have multiple shells in the same window. You don't need to open new windows for a second connection to the same remote server, you can simply press {{C-a c}} inside the screen session. And if your computer crashes, you screen session on the remote server survives, you can re-attach to a previous screen session with {{screen -R}}. ", 
190
 
            "summary": "The first command you should run after you login to a remote server", 
191
 
            "created_dt": "2011-09-15 20:24:43", 
192
 
            "user": 2, 
193
 
            "line": "screen", 
194
 
            "is_published": true
195
 
        }
196
 
    }, 
197
 
    {
198
 
        "pk": 19, 
199
 
        "model": "main.oneliner", 
200
 
        "fields": {
201
 
            "limitations": "The :bufdo command might not be there in old versions of vim.", 
202
 
            "explanation": "- The inner grep will search recursively in specified directory and print the filenames that contain the pattern.\r\n- All files will be opened in vim, one buffer per file.\r\n- The :bufdo command in vim will perform the replacement in all buffers, and save all buffers.", 
203
 
            "summary": "Replace a regexp pattern in many files at once easily", 
204
 
            "created_dt": "2011-09-15 21:50:50", 
205
 
            "user": 2, 
206
 
            "line": "vim $(grep -rl pattern dirpath)\r\n:bufdo %s/pattern/replacement/g | update", 
207
 
            "is_published": true
208
 
        }
209
 
    }, 
210
 
    {
211
 
        "pk": 20, 
212
 
        "model": "main.oneliner", 
213
 
        "fields": {
214
 
            "limitations": "", 
215
 
            "explanation": "- {{find path_to_dir -type d}} finds all the subdirectories\r\n- {{tail -r}} reverses the order. This is important to make \"leaf\" directories come first! \r\n- {{target=...}} stuff constructs the new name, removing spaces from the leaf component and keeping everything before that the same\r\n- {{echo mv ...}} for safety you should run with \"echo\" first, if the output looks good then remove the \"echo\" to really perform the rename", 
216
 
            "summary": "Remove spaces recursively from all subdirectories of a directory", 
217
 
            "created_dt": "2011-09-20 14:52:07", 
218
 
            "user": 2, 
219
 
            "line": "find path_to_dir -type d | tail -r | while read line; do target=$(dirname \"$line\")/$(basename \"$line\" | tr -d ' '); echo mv \"$line\" \"$target\"; done\r\n", 
220
 
            "is_published": true
221
 
        }
222
 
    }, 
223
 
    {
224
 
        "pk": 21, 
225
 
        "model": "main.oneliner", 
226
 
        "fields": {
227
 
            "limitations": "", 
228
 
            "explanation": "alias: allows you to define a shortcut to a longer command. In this case 'ls' with the flags set for long listing, human readable no group and in color, not displaying the group, appending a slash to directories and color coding the output.", 
229
 
            "summary": "aliases the ls command to display the way I like it", 
230
 
            "created_dt": "2011-09-21 22:25:03", 
231
 
            "user": 5, 
232
 
            "line": "alias ls='ls -lhGpt --color=always'", 
233
 
            "is_published": true
234
 
        }
235
 
    }
236
 
]