Last active
October 25, 2023 22:06
-
-
Save Ceelog/39862d297d9c85e743b3b5111b7d44cb to your computer and use it in GitHub Desktop.
Revisions
-
Ceelog revised this gist
Apr 30, 2020 . 8 changed files with 237 additions and 79 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ {"lastUpload":"2020-04-30T04:17:22.471Z","extensionVersion":"v3.4.3"} 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,122 @@ [ { "metadata": { "id": "e337c67b-55c2-4fef-8949-eb260e7fb7fd", "publisherId": "Shan.code-settings-sync", "publisherDisplayName": "Shan" }, "name": "code-settings-sync", "publisher": "Shan", "version": "3.4.3" }, { "metadata": { "id": "26a529c9-2654-4b95-a63f-02f6a52429e6", "publisherId": "zhuangtongfa.material-theme", "publisherDisplayName": "zhuangtongfa" }, "name": "material-theme", "publisher": "zhuangtongfa", "version": "3.3.1" }, { "metadata": { "id": "93ce222b-5f6f-49b7-9ab1-a0463c6238df", "publisherId": "ms-vscode-remote.remote-containers", "publisherDisplayName": "ms-vscode-remote" }, "name": "remote-containers", "publisher": "ms-vscode-remote", "version": "0.112.0" }, { "metadata": { "id": "607fd052-be03-4363-b657-2bd62b83d28a", "publisherId": "ms-vscode-remote.remote-ssh", "publisherDisplayName": "ms-vscode-remote" }, "name": "remote-ssh", "publisher": "ms-vscode-remote", "version": "0.51.0" }, { "metadata": { "id": "bfeaf631-bcff-4908-93ed-fda4ef9a0c5c", "publisherId": "ms-vscode-remote.remote-ssh-edit", "publisherDisplayName": "ms-vscode-remote" }, "name": "remote-ssh-edit", "publisher": "ms-vscode-remote", "version": "0.51.0" }, { "metadata": { "id": "f0c5397b-d357-4197-99f0-cb4202f22818", "publisherId": "ms-vscode-remote.remote-wsl", "publisherDisplayName": "ms-vscode-remote" }, "name": "remote-wsl", "publisher": "ms-vscode-remote", "version": "0.44.2" }, { "metadata": { "id": "b5eaebe8-c8c7-495a-80c5-3ba4a7a91c35", "publisherId": "andischerer.theme-atom-one-dark", "publisherDisplayName": "andischerer" }, "name": "theme-atom-one-dark", "publisher": "andischerer", "version": "0.0.1" }, { "metadata": { "id": "829a192d-496c-44ac-87f3-0a84ce36a853", "publisherId": "emmanuelbeziat.vscode-great-icons", "publisherDisplayName": "emmanuelbeziat" }, "name": "vscode-great-icons", "publisher": "emmanuelbeziat", "version": "2.1.47" }, { "metadata": { "id": "9ccc1dd7-7ec4-4a46-bd4f-7d7b8b9d322a", "publisherId": "vscode-icons-team.vscode-icons", "publisherDisplayName": "vscode-icons-team" }, "name": "vscode-icons", "publisher": "vscode-icons-team", "version": "10.1.1" }, { "metadata": { "id": "e4ee7751-6514-4731-9cdb-7580ffa9e70b", "publisherId": "MS-CEINTL.vscode-language-pack-zh-hans", "publisherDisplayName": "MS-CEINTL" }, "name": "vscode-language-pack-zh-hans", "publisher": "MS-CEINTL", "version": "1.44.2" }, { "metadata": { "id": "414b2873-c80e-4dc6-9031-bd185cfb3944", "publisherId": "william-voyek.vscode-nginx", "publisherDisplayName": "william-voyek" }, "name": "vscode-nginx", "publisher": "william-voyek", "version": "0.7.2" }, { "metadata": { "id": "23d72dfc-8dd1-4e30-926e-8783b4378f13", "publisherId": "ms-vscode-remote.vscode-remote-extensionpack", "publisherDisplayName": "ms-vscode-remote" }, "name": "vscode-remote-extensionpack", "publisher": "ms-vscode-remote", "version": "0.20.0" } ] 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ { "workspaceFolder": "/" } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ { "agentPort": 33895, "osReleaseId": "centos", "arch": "x86_64", "webUiAccessToken": "", "sshAuthSock": "", "tmpDir": "/run/user/0", "platform": "linux", "pid": 65426, "ipcHandlePath": "/var/folders/9t/jnlm057n1fs4kvg005_0l9xr0000gn/T/vscode-ssh-askpass-4938bb89880a3c5080126cdc629310075a0d5328.sock", "socksPort": 53814, "startupTime": 1588218230104 } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ { "agentPort": 43796, "osReleaseId": "centos", "arch": "x86_64", "webUiAccessToken": "", "sshAuthSock": "", "tmpDir": "/run/user/0", "platform": "linux", "pid": 65527, "ipcHandlePath": "/var/folders/9t/jnlm057n1fs4kvg005_0l9xr0000gn/T/vscode-ssh-askpass-c0cc698581744f7039d9fabf35293642059affbc.sock", "socksPort": 53825, "startupTime": 1588218238647 } 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 charactersOriginal file line number Diff line number Diff line change @@ -1,79 +0,0 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ { "window.zoomLevel": 0, "workbench.iconTheme": "vscode-great-icons", "editor.fontSize": 16, "vsicons.dontShowNewVersionMessage": true, "gitlens.advanced.messages": { "suppressCommitHasNoPreviousCommitWarning": false, "suppressCommitNotFoundWarning": false, "suppressFileNotUnderSourceControlWarning": false, "suppressGitVersionWarning": false, "suppressLineUncommittedWarning": false, "suppressNoRepositoryWarning": false, "suppressResultsExplorerNotice": false, "suppressShowKeyBindingsNotice": true }, "gitlens.codeLens.authors.enabled": false, "gitlens.codeLens.recentChange.enabled": false, "gitlens.currentLine.enabled": false, "gitlens.statusBar.enabled": false, "workbench.statusBar.feedback.visible": false, "php.suggest.basic": false, "workbench.colorTheme": "Atom One Dark", "[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[html]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "prettier.printWidth": 1024, "todo-tree.highlights.enabled": true, "[php]": { "editor.defaultFormatter": "bmewburn.vscode-intelephense-client" }, "explorer.confirmDragAndDrop": false, "explorer.confirmDelete": false, "php-cs-fixer.executablePath": "${extensionPath}/php-cs-fixer.phar", "php-cs-fixer.lastDownload": 1588051228981, "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "files.exclude": { "**/.classpath": true, "**/.project": true, "**/.settings": true, "**/.factorypath": true }, "editor.suggestSelection": "first", "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", "java.errors.incompleteClasspath.severity": "ignore", "vs-kubernetes": { "vs-kubernetes.knownKubeconfigs": [ "/root/.kube/pre.thanos.config" ], "vs-kubernetes.kubeconfig": "/root/.kube/pre.thanos.config", "vs-kubernetes.minikube-path": "/root/.vs-kubernetes/tools/minikube/linux-amd64/minikube", "vs-kubernetes.helm-path": "/root/.vs-kubernetes/tools/helm/linux-amd64/helm", "vs-kubernetes.draft-path": "/root/.vs-kubernetes/tools/draft/linux-amd64/draft" }, "todo-tree.tree.showScanModeButton": false, "files.associations": { "*.tpl": "html" }, "extensions.ignoreRecommendations": false, "git.ignoreLegacyWarning": true, "terminal.integrated.shell.osx": "/bin/zsh", "rust-client.rustupPath": "~/.cargo/bin/rustup", "sync.gist": "39862d297d9c85e743b3b5111b7d44cb" } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ { /* // Place your snippets for PHP here. Each snippet is defined under a snippet name and has a prefix, body and // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the // same ids are connected. // Example: "Print to console": { "prefix": "log", "body": [ "console.log('$1');", "$2" ], "description": "Log output to console" } */ } -
Ceelog revised this gist
Mar 9, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,8 @@ -- -- access_by_lua_file /etc/nginx/lua/ip_blacklist.lua; -- -- from https://gist.github.com/chrisboulton/6043871 -- modify by Ceelog local redis_host = "your.redis.server.here" local redis_port = 6379 -
Ceelog created this gist
Mar 9, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,78 @@ -- a quick LUA access script for nginx to check IP addresses against an -- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403. -- -- allows for a common blacklist to be shared between a bunch of nginx -- web servers using a remote redis instance. lookups are cached for a -- configurable period of time. -- -- block an ip: -- redis-cli SADD ip_blacklist 10.1.1.1 -- remove an ip: -- redis-cli SREM ip_blacklist 10.1.1.1 -- -- also requires lua-resty-redis from: -- https://github.com/agentzh/lua-resty-redis -- -- your nginx http context should contain something similar to the -- below: (assumes resty/redis.lua exists in /etc/nginx/lua/) -- -- lua_package_path "/etc/nginx/lua/?.lua;;"; -- lua_shared_dict ip_blacklist 1m; -- -- you can then use the below (adjust path where necessary) to check -- against the blacklist in a http, server, location, if context: -- -- access_by_lua_file /etc/nginx/lua/ip_blacklist.lua; -- -- @author Ceelog local redis_host = "your.redis.server.here" local redis_port = 6379 -- connection timeout for redis in ms. don't set this too high! local redis_connection_timeout = 100 -- check a set with this key for blacklist entries local redis_key = "ip_blacklist" -- cache lookups for this many seconds local cache_ttl = 60 -- end configuration local ip = ngx.var.remote_addr local ip_blacklist = ngx.shared.ip_blacklist local last_update_time = ip_blacklist:get("last_update_time"); -- only update ip_blacklist from Redis once every cache_ttl seconds: if last_update_time == nil or last_update_time < ( ngx.now() - cache_ttl ) then local redis = require "resty.redis"; local red = redis:new(); red:set_timeout(redis_connect_timeout); local ok, err = red:connect(redis_host, redis_port); if not ok then ngx.log(ngx.DEBUG, "Redis connection error while retrieving ip_blacklist: " .. err); else local new_ip_blacklist, err = red:smembers(redis_key); if err then ngx.log(ngx.DEBUG, "Redis read error while retrieving ip_blacklist: " .. err); else -- replace the locally stored ip_blacklist with the updated values: ip_blacklist:flush_all(); for index, banned_ip in ipairs(new_ip_blacklist) do ip_blacklist:set(banned_ip, true); end -- update time ip_blacklist:set("last_update_time", ngx.now()); end end end if ip_blacklist:get(ip) then ngx.log(ngx.DEBUG, "Banned IP detected and refused access: " .. ip); return ngx.exit(ngx.HTTP_FORBIDDEN); end