Skip to content

Instantly share code, notes, and snippets.

View apla's full-sized avatar

ivan baktsheev apla

View GitHub Profile
@apla
apla / GitHub-api.js
Created November 9, 2023 19:27
GitHub releases
View GitHub-api.js
const accessToken = 'YOUR_GITHUB_ACCESS_TOKEN';
const repoOwner = 'REPO_OWNER';
const repoName = 'REPO_NAME';
const productionTag = 'production/<number>';
const targetBranch = 'development';
async function findRecentReleaseCommit(branch) {
const accessToken = 'YOUR_GITHUB_ACCESS_TOKEN'; // Replace with your GitHub access token
const url = `https://api.github.com/repos/${repoOwner}/${repoName}/commits?sha=${branch}`;
@apla
apla / dns-check.js
Created November 6, 2023 19:45
dns-check.js
View dns-check.js
const AWS = require('aws-sdk');
const dns = require('dns');
const fs = require('fs');
// Set your AWS credentials and Region
AWS.config.update({
accessKeyId: 'YOUR_ACCESS_KEY',
secretAccessKey: 'YOUR_SECRET_ACCESS_KEY',
region: 'us-east-1', // Change to your desired AWS region
});
@apla
apla / beeline,smartbox-turbo-plus.sh
Created October 25, 2023 18:11
Beeline Smartbox Turbo+ OEM settings for OpenWrt firmware selector
View beeline,smartbox-turbo-plus.sh
#!/bin/sh
. /lib/functions.sh
. /lib/functions/system.sh
get_model_name () {
cat /proc/device-tree/compatible | tr -s '\000' '\n' | head -n 1
}
get_oem_data_parser () {
@apla
apla / convert-jscad-v1.js
Last active October 3, 2021 14:07
WIP Convert JSCAD V1 => V2
View convert-jscad-v1.js
const fs = require('fs').promises;
const { parse } = require('acorn');
const acornWalk = require('acorn-walk');
// Important limitations:
// Variables in attributes cannot be processed automatically, converter will throw in that case
// Whitespace and source comments lost sometimes, especially in first argument
// Constructs like x.difference(y), z.union(a, b, c) probably not supported - need parameter reordering
// If you see it not works and want to add support for that, modify `cluster.chunks.reduce` in `processCluster`
@apla
apla / proxy.pac
Created July 10, 2021 20:36
proxy
View proxy.pac
function FindProxyForURL(url, host) {
if (
dnsDomainIs(host, ".rutracker.org")
|| dnsDomainIs(host, ".lostfilm.tv")
) {
return "PROXY 10.10.10.200:18080; DIRECT";
} else {
return "DIRECT";
}
}
@apla
apla / README.md
Last active March 21, 2020 20:42
Aliexpress switch to global
View README.md

Switching from russian to english version for aliexpress

Open Console from Developer tools on *.aliexpress.com, then enter

document.cookie = document.cookie.split ('; ').filter (v => v.match (/^aep_usuc_f/))[0].replace ('site=rus', 'site=glo').replace ('b_locale=ru_RU', 'b_locale=en_US') + '; domain=.aliexpress.com';
document.cookie = document.cookie.split ('; ').filter (v => v.match (/^intl_locale/))[0].replace ('ru_RU', 'en_US') + '; domain=.aliexpress.com';
@apla
apla / 04_factory_defaults.sh
Last active March 16, 2020 19:34
OpenWrt preconfigured wlan
View 04_factory_defaults.sh
#!/bin/sh
. /lib/functions.sh
. /lib/functions/system.sh
get_board_name () {
cat /proc/device-tree/compatible | tr -s '\000' '\n' | head -n 1
}
mtd_get_cstring () {
@apla
apla / guest.md
Last active November 8, 2019 04:23
luci segregated lans
View guest.md
  1. Select menu item Network > Switch and click Add button under VLAN ID section
  2. For the new VLAN, make sure the CPU is tagged, then select untagged for the LAN port(s) you are want to use this new VLAN. Make sure that port is off for all other VLANs. Click Save & Apply
  3. In the Network > Interfaces click Add new interface button (under the interface overview section)
  4. Name the new interface (Guest), select the new VLAN (likely something like eth0.3); the rest of the defaults are okay. Click Submit.
  5. Set your desired IPv4 address (for the router on this VLAN), net mask, and gateway, and any other stuff here you want. Click Save.
  6. Click Setup DHCP Server button. Defaults here are fine, but you can change them if you want. Click Save.
  7. Select the Firewall Settings tab for the interface. The radio button will default to the unspecified -or- create box. Name your firewall zone (guest). Click Save & Apply.
  8. Network > Firewall > Zones section,
@apla
apla / gpio
Last active June 15, 2019 23:45
OrangePI protobor display monitor code
View gpio
#!/bin/bash
cmd=$1
pin=$2
mode=$3
value=$3
pin_num=