Skip to content

Instantly share code, notes, and snippets.

View SanariSan's full-sized avatar
😯
1 2 Fizz 4 Buzz

SanariSan

😯
1 2 Fizz 4 Buzz
  • krak.ai
  • Georgia, Tbilisi
View GitHub Profile
@SanariSan
SanariSan / charles.sh
Created January 16, 2022 19:23
Charles notes
# Installing cert on ubuntu:
# Save .pem file from chares, convert it to .crt with
openssl x509 -in cert.pem -inform PEM -out cert.crt
# Move to /usr/local/share/ca-certificates/extra
sudo mv cert.crt /usr/local/share/ca-certificates/extra
# Run
sudo update-ca-certificates
#
# Import .pem to Firefox or anywhere
@SanariSan
SanariSan / CommonJS-Modules.md
Last active February 27, 2022 17:21
__dirname / __filename with "Modules"

Replacement for __dirname and __filename when using Modules over CommonJS

import {fileURLToPath} from 'url';
import path from 'path';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@SanariSan
SanariSan / axios_proxy.js
Created October 18, 2021 17:43
Axios proxy http/s socks
// socks
// const axios_ = require("axios");
// const SocksProxyAgent = require("socks-proxy-agent");
import { default as axios_ } from "axios";
import SocksProxyAgent from "socks-proxy-agent";
const httpsAgent = new SocksProxyAgent("socks://127.0.0.1:1080");
const httpAgent = httpsAgent;
const axios = axios_.create({ httpsAgent, httpAgent });
@SanariSan
SanariSan / name.desktop
Last active February 27, 2022 17:21
Desktop entry template
# put it to /home/name/.local/share/applications
# or /usr/share/applications
[Desktop Entry]
Encoding=UTF-8
Name=NAME
Exec=/home/name/.local/share/applications/orAnyOtherPathToFile
Icon=GetItHere-https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
Type=Application
Categories=Application;
/*
<div id="foo">123</div>
<button onClick="trigger();">toggle</button>
*/
const once = (el, eventName, handler) => el.addEventListener(eventName, handler);
const onceHandlerWrap = (fn, eventName) => {
@SanariSan
SanariSan / Postgre
Last active February 27, 2022 17:21
Postgre
# Setup
sudo apt install postgresql
# sudo pgcheck
sudo systemctl is-active postgresql
sudo systemctl is-enabled postgresql
sudo pg_isready
sudo systemctl status postgresql
# pgadmin4 install
@SanariSan
SanariSan / IPTABLES
Last active February 27, 2022 17:23
https://wiki.merionet.ru/servernye-resheniya/14/pogruzhenie-v-iptables-teoriya-i-nastrojka/
https://losst.ru/nastrojka-iptables-dlya-chajnikov
https://linuxconfig.org/how-to-turn-on-off-ip-forwarding-in-linux
https://help.ubuntu.com/community/IptablesHowTo
# for rerouting
cat /proc/sys/net/ipv4/ip_forward
echo 1 >/proc/sys/net/ipv4/ip_forward
sudo sysctl -w net.ipv4.ip_forward=1
@SanariSan
SanariSan / OVERVIEW.TXT
Created February 17, 2022 10:46
adb key moments
ORIGIN: https://android.googlesource.com/platform/system/core/+/android-2.3.4_r1/adb/OVERVIEW.TXT
Implementation notes regarding ADB.
I. General Overview:
The Android Debug Bridge (ADB) is used to:
- keep track of all Android devices and emulators instances
connected to or running on a given host developer machine
- implement various control commands (e.g. "adb shell", "adb pull", etc..)
for the benefit of clients (command-line users, or helper programs like
DDMS). These commands are what is called a 'service' in ADB.