Skip to content

Instantly share code, notes, and snippets.

View vyach-vasiliev's full-sized avatar

ฬะทçะรโลนร vyach-vasiliev

  • Milky Way galaxy, planet Earth
View GitHub Profile
@vyach-vasiliev
vyach-vasiliev / getBGImgURLsFromCSSs.js
Last active June 11, 2017 14:41 — forked from donut/getBGImgURLsFromCSSs.js
Builds a list of images found in the linked style sheets
/* Builds a list of images found in the linked style sheets
*
* Adapted from stackoverflow.com/questions/2430503/list-of-all-background-images-in-dom/2453880#2453880
*
* This method has the advantage of finding URLs for background images that no
* element in the DOM uses yet.
* Author: Donovan Mueller @donut (https://github.com/donut)
* Contributors: Vyacheslav Vasiliev @vyach-vasiliev (https://gist.github.com/vyach-vasiliev)
*
* @return {array}
@vyach-vasiliev
vyach-vasiliev / static_server.js
Created March 10, 2019 11:05 — forked from jianwu/static_server.js
Node.JS static file web server, also provides CORSProxy, Http/Https proxy function. Put it in your path to fire up servers in any directory, takes an optional port argument. If provide second https port argument, it will also start https. For https to work, need to put key and cert file in the folder.
/**
Static http server implemented with NodeJS.
Features:
1. No external dependencies
2. Support http/https, with custom port.
3. Support CORSProxy function
4. Zero configuration, convension over configuration
5. Support gzip compression
@vyach-vasiliev
vyach-vasiliev / duplicate-row.js
Last active April 11, 2019 12:02 — forked from develmaycare/duplicate-row.js
Duplicate a row in Google Sheets.
/* To use this in a Google Sheet:
1. Go to Tools > Script Editor.
2. Save the script.
3. Paste this script and click on the bug symbol.
4. Authorize the script.
5. Refresh the sheet.
For setting hot-key:
Tools - Macros - Manage macros
@vyach-vasiliev
vyach-vasiliev / google-people-jsapi.html
Created May 3, 2019 20:28 — forked from ddbb1977/google-people-jsapi.html
Retrieves the names and phone numbers available in Google Contacts. It's almost the same code available at https://developers.google.com/people/quickstart/js but including the phone numbers
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
// Your Client ID can be retrieved from your project in the Google
// Developer Console, https://console.developers.google.com
// Also the URL has to be allowed or 401 errors will be thrown on the console
var CLIENT_ID = '<YOUR_CLIENT_ID>';
@vyach-vasiliev
vyach-vasiliev / ssh tunneling.md
Created September 15, 2020 10:53 — forked from mhulse/ssh tunneling.md
SSH Tunneling: Map port from remote machine to your local machine so you can work from the remote DB (example using Django DB settings)...

SSH Tunneling

  1. In your local_settings.py file:

    DATABASES = {
    	'default': {
    		'ENGINE': 'django.db.backends.postgresql_psycopg2',
    		'NAME': 'django_%s' % (PROJECT_NAME,),
    

'USER': xxxx,

@vyach-vasiliev
vyach-vasiliev / KotlinAndroidMainApplication1.kt
Last active November 7, 2020 14:02 — forked from paraya3636/KotlinAndroidMainApplication
Kotlin Android MainApplication class for global applicationContext.
// Author Keisuke Miura
// Not object class. AndroidManifest.xml error happen.
class MainApplication : Application() {
init {
instance = this
}
companion object {
private var instance: MainApplication? = null
@vyach-vasiliev
vyach-vasiliev / security.conf
Created November 24, 2020 11:19 — forked from mattia-beta/security.conf
NGINX Security Config
## Block SQL injections
set $block_sql_injections 0;
if ($query_string ~ "union.*select.*\(") {
set $block_sql_injections 1;
}
if ($query_string ~ "union.*all.*select.*") {
set $block_sql_injections 1;
}
@vyach-vasiliev
vyach-vasiliev / ddos.conf
Created November 24, 2020 11:19 — forked from mattia-beta/ddos.conf
IPtables DDoS Protection for VPS
### 1: Drop invalid packets ###
/sbin/iptables -t mangle -A PREROUTING -m conntrack --ctstate INVALID -j DROP
### 2: Drop TCP packets that are new and are not SYN ###
/sbin/iptables -t mangle -A PREROUTING -p tcp ! --syn -m conntrack --ctstate NEW -j DROP
### 3: Drop SYN packets with suspicious MSS value ###
/sbin/iptables -t mangle -A PREROUTING -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -j DROP
### 4: Block packets with bogus TCP flags ###
@vyach-vasiliev
vyach-vasiliev / pipreplace.sh
Created January 8, 2021 14:57 — forked from stucka/pipreplace.sh
Force pip to reinstall all Python packages (works great with https://gist.github.com/stucka/0ced1cc71e1a5c374a18874471636d69)
#!/bin/bash
pip freeze --local >pipfreeze.txt
pip install --upgrade --force-reinstall -r pipfreeze.txt
# second variant
#apt-get install libxml2-dev libssl-dev libffi-dev libxslt1-dev python-dev libjpeg-dev
#pip freeze --local >pipfreeze.txt
#tr '\n' ' ' < pipfreeze.txt >pipfreeze2.txt
@vyach-vasiliev
vyach-vasiliev / dep.ts
Created April 28, 2022 16:23 — forked from Bnaya/dep.ts
ts-node + esm
export function funci() {
return "AHH HHHHAAA";
}