Skip to content

Instantly share code, notes, and snippets.

View astepchenko's full-sized avatar

Aleksandr Stepchenko astepchenko

View GitHub Profile
@astepchenko
astepchenko / README
Created September 30, 2024 21:51 — forked from patrakov/README
Automatically reinstall OpenWRT packages after firmware upgrades
The script helps you restore all installed OpenWRT packages after upgrading the main firmware image via sysupgrade. It works
ONLY if the default firmware image provided by the OpenWRT project is sufficient to get connected to the Internet, but you
want some extra packages for additional functionality. In other words, it WILL NOT WORK if connecting to the Internet
requires installing extra packages (e.g., a kernel module for your LTE modem).
The script has been tested for upgrading from OpenWRT 18.06.1 to 18.06.2 and to a development snapshot, as well as between
development snapshots. On LEDE 17.01.x, "flock" is not a part of the default image, so has to be installed manually.
Initial setup:
@astepchenko
astepchenko / cloudfront_invalidate_pipeline.groovy
Created April 17, 2024 12:40 — forked from lepffm/cloudfront_invalidate_pipeline.groovy
jenkins pipeline script for cloudfront invalidattion
// reference : https://stackoverflow.com/questions/56294317/how-to-programmatically-get-distribution-id-to-invalidate-cloudfront-cache
// prerequisite : aws cli, jq , aws credentials setting
pipeline {
parameters {
stringParam(description: 'your domain name', name: 'domain')
}
agent any
stages{
stage('init'){
steps{
@astepchenko
astepchenko / fix-wsl2-dns-resolution
Created January 24, 2023 18:52 — forked from coltenkrauter/fix-wsl2-dns-resolution.md
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@astepchenko
astepchenko / New MS Teams Profile.cmd
Last active July 4, 2022 14:05 — forked from TritusIX/New MS Teams Profile.cmd
For running multiple MS Teams accounts side by side. Save this with the name of the MS Teams profile you wish to use. When launched, a folder will be created in your user profile. Fixed missing "Desktop folder " See https://danielsmon.com/2020/04/02/multiple-ms-teams-accounts-on-the-desktop/.
@ECHO OFF
REM Uses the file name as the profile name
SET MSTEAMS_PROFILE=%~n0
ECHO - Using profile "%MSTEAMS_PROFILE%"
SET "OLD_USERPROFILE=%USERPROFILE%"
SET "USERPROFILE=%LOCALAPPDATA%\Microsoft\Teams\CustomProfiles\%MSTEAMS_PROFILE%"
REM Ensure there is a downloads folder to avoid error described at
@astepchenko
astepchenko / FAR2L.itermkeymap
Created November 10, 2021 22:11 — forked from anteo/FAR2L.itermkeymap
iTerm2 key mappings for FAR2L
{"Touch Bar Items":[],"Key Mappings":{"0x35-0x40000-0x17":{"Label":"","Action":10,"Text":"[55;7~"},"0xf72d-0x80000-0x79":{"Label":"","Text":"[6;3~","Action":10},"0x28-0x60000-0x19":{"Label":"","Action":10,"Text":"[59;6~"},"0xf708-0x40000-0x60":{"Label":"","Text":"[15;5~","Action":10},"0xf706-0x20000-0x63":{"Label":"","Text":"O2R","Action":10},"0x23-0x60000-0x14":{"Label":"","Action":10,"Text":"[53;6~"},"0xf70d-0x40000-0x6d":{"Label":"","Text":"[21;5~","Action":10},"0xf708-0x20000-0x60":{"Label":"","Text":"[15;2~","Action":10},"0x38-0x80000-0x1c":{"Text":"8","Label":"","Action":10},"0xf706-0x40000-0x63":{"Label":"","Text":"O5R","Action":10},"0x34-0x80000-0x15":{"Text":"4","Label":"","Action":10},"0xf703-0x240000-0x7c":{"Label":"","Text":"[1;5C","Action":10},"0xf72d-0x40000-0x79":{"Label":"","Text":"[6;5~","Action":10},"0xf70d-0x20000-0x6d":{"Label":"","Text":"[21;2~","Action":10},"0xf702-0x240000-0x7b":{"Label":"","Text":"[1;5D","Action":10},"0xf700-0x220000-0x7e":{"Label":"","Text":"[2A","Action":10},"0xd-0x4
@astepchenko
astepchenko / security.conf
Created October 25, 2021 22:23 — forked from ambroisemaupate/security.conf
Nginx CSP example
# config to don't allow the browser to render the page inside an frame or iframe
# and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking
# if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri
# https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options
add_header X-Frame-Options SAMEORIGIN;
# when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header,
# to disable content-type sniffing on some browsers.
# https://www.owasp.org/index.php/List_of_useful_HTTP_headers
# currently suppoorted in IE > 8 http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx
@astepchenko
astepchenko / key_signal.ps1
Created October 21, 2021 13:27 — forked from si-hyeon/key_signal.ps1
Powershell script to keep the key signal
# Send a key that not used well on your environment
# This way works well for screensaver activated by secure program on Windows 7
# key mapping ref. https://technet.microsoft.com/en-us/library/ff731008.aspx
$myshell = New-Object -com "Wscript.Shell"
while ($true)
{
$myshell.sendKeys("{NUMLOCK}{NUMLOCK}")
Start-Sleep -Seconds 60
}
@astepchenko
astepchenko / agnoster-newline.zsh-theme
Created August 12, 2021 14:50 — forked from nweddle/agnoster-newline.zsh-theme
Agnoster ZSH Theme with New Line
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
@astepchenko
astepchenko / protect-kube-config.md
Created July 9, 2021 09:38 — forked from PatrLind/protect-kube-config.md
How to protect your ~/.kube/ configuration

How to protect your ~/.kube/ configuration

I had a need to protect my Kubernetes config file on my computer against accidental or malicious change or reading, so I came up with this way of protecting the config files.

How it works

The ~/.kube folder is mounted using encfs. By using the --ondemand flag it will automatically ask for the encryption key/password when accessed and keep

@astepchenko
astepchenko / New_MS_Teams_Profile.cmd
Last active July 9, 2021 08:34 — forked from DanielSmon/New MS Teams Profile.cmd
For running multiple MS Teams accounts side by side. Save this with the name of the MS Teams profile you wish to use. When launched, a folder will be created in your user profile. See https://danielsmon.com/2020/04/02/multiple-ms-teams-accounts-on-the-desktop/.
@ECHO OFF
REM Uses the file name as the profile name
SET MSTEAMS_PROFILE=%~n0
ECHO - Using profile "%MSTEAMS_PROFILE%"
SET "OLD_USERPROFILE=%USERPROFILE%"
SET "USERPROFILE=%LOCALAPPDATA%\Microsoft\Teams\CustomProfiles\%MSTEAMS_PROFILE%"
REM Ensure there is a Downloads folder to avoid error described at