Ниже изменения которые нужно внести в код из статьи.
This file contains hidden or 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
| /* | |
| * dropbox_ext4.c | |
| * | |
| * Compile like this: | |
| * gcc -shared -fPIC -ldl -o libdropbox_ext4.so dropbox_ext4.c | |
| * | |
| * Run Dropbox like this: | |
| * LD_PRELOAD=./libdropbox_ext4.so ~/.dropbox-dist/dropboxd | |
| */ | |
Hey guys,
I have a really terrible hack, but it appears to work, so...
Dropbox calls statfs64 to get the filesystem type. Now, if only there was a way to change its return value to "ext4"... oh wait, there is!
Here's code of the new function: dropbox_ext4.c
/*
This file contains hidden or 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
| <?php | |
| if (!function_exists('stats_rand_gen_normal')) { | |
| function stats_rand_gen_normal($mu, $sigma) { | |
| do { | |
| $u = (rand() / getrandmax()) * 2 - 1; | |
| $v = (rand() / getrandmax()) * 2 - 1; | |
| $s = $u * $u + $v * $v; | |
| } while ($s >= 1 || $s == 0); | |
| $multiplier = sqrt(-2 * log($s) / $s); |
We can't make this file beautiful and searchable because it's too large.
This file contains hidden or 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
| 10430,10504,1,1 | |
| 10472,10534,13,2 | |
| 10472,10548,3,3 | |
| 14470,14672,1,4 | |
| 14470,14698,13,5 | |
| 15119,15342,3,6 | |
| 16140,16409,1,7 | |
| 17453,17513,1,8 | |
| 17453,17542,1,9 | |
| 17453,17640,7,10 |
This file contains hidden or 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
| CPUS ?= $(shell nproc) | |
| MAKEFLAGS += --jobs=$(CPUS) | |
| all: | |
| @echo \'$(MAKEFLAGS)\' must have --jobs=$(CPUS) |
This file contains hidden or 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
| function toHankaku(original) { | |
| var result = ''; | |
| for (var i = 0; i < original.length; i = i+1) { | |
| var tmp = original.charCodeAt(i); | |
| if ((0xff0f < tmp) && (tmp < 0xff1a)) { | |
| result += String.fromCharCode(tmp - 0xfee0); | |
| } else { | |
| result += String.fromCharCode(tmp); | |
| } | |
| } |
This file contains hidden or 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
| package main | |
| import ( | |
| "example.com/example" | |
| ) | |
| func main() { | |
| example.Hello() | |
| } |
$ add-date-suffix access.log.2.gz
'access.log.2.gz' -> 'access.log-20170821.gz'
Use this script if you happen to forget to add dateext for logrotate:
tee /etc/logrotate.d/defaults <<EOF
dateext
compress
delaycompress
EOF
- Put
update-cf.shto/etc/nginx/; chmod +x /etc/nginx/update-cf.sh- Add an entry in crontab to call it weekly:
@weekly sleep $RANDOM; /etc/nginx/update-cf.sh - Add
/etc/nginx/cloudflare.conf - Use it.
Example:
server {
server_name www.example.com;