Skip to content

Instantly share code, notes, and snippets.

View codeniko's full-sized avatar

Nikolay Feldman codeniko

View GitHub Profile
#!/usr/bin/bash
MAM_ID_FILE=~/mam_id.txt
TIMESTAMP=$(date +%s)000
# URL="https://www.myanonamouse.net/json/bonusBuy.php/?spendtype=upload&amount=1&_=${TIMESTAMP}"
URL="https://www.myanonamouse.net/json/bonusBuy.php/?spendtype=upload&amount=Max%20Affordable%20&_=${TIMESTAMP}"
mamId=`cat ${MAM_ID_FILE}`
echo "$URL"
curl -i "${URL}" \
@codeniko
codeniko / gist:a89e4476379e1c7ca69f83ca259863ee
Created March 8, 2023 19:38
Windows 10/11 iso burn to USB from mac
// Disk N is the id of the external usb drive from the diskutil commands
// This transfers most files over except for the >4GB file, which we need to use 3rd party tool to split
// Double tap the Windows 11/10 iso to mount it, plug in the USB
brew install wimlib
diskutil list
diskutil eraseDisk MS-DOS "WINDOWS11" MBR diskN
ls /Volumes
rsync -avh --progress --exclude=sources/install.wim /Volumes/CCCOMA_X64FRE_EN-US_DV9/ /Volumes/WINDOWS11
@codeniko
codeniko / 0_reverse engineering.md
Last active April 16, 2024 08:01
Android Reverse Engineering
@codeniko
codeniko / gen-fake-cert-and-key
Created October 24, 2020 08:24
generate fake cert and key for https testing in dev
openssl req -x509 -sha256 -nodes -days 9365 -newkey rsa:2048 -keyout fake-key.pem -out fake-cert.pem
@codeniko
codeniko / sshd_config
Last active September 24, 2020 05:13
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
@codeniko
codeniko / ssdp_discover.sh
Created August 3, 2020 03:28
Broadcast SSDP request or specify ip as arg1
#!/usr/bin/env python2
import socket
import sys
dst = "239.255.255.250"
if len(sys.argv) > 1:
dst = sys.argv[1]
st = "upnp:rootdevice"
if len(sys.argv) > 2:
st = sys.argv[2]
@codeniko
codeniko / Example systemd .system file
Created July 24, 2020 02:22
soft link it to /etc/systemd/system
[Unit]
Description=Universal Media Server
After=network.target
After=network-online.target
[Service]
User=pi
ExecStart=/opt/ums/UMS.sh headless
TimeoutSec=30
Restart=on-failure
@codeniko
codeniko / namecheap_ddns.etc.ddclient.conf
Last active June 27, 2020 12:24
Namecheap ddns configuration
from https://ktmresearch.com/2014/10/dynamic-dns-ddclient-with-namecheap/
service ddclient restart
daemon=300
ssl=yes
use=web, web=checkip.dyndns.com/, web-skip='IP Address'
protocol=namecheap
server=dynamicdns.park-your-domain.com
login=nfeld.com
@codeniko
codeniko / UNMS-Unifi-Pi-Buster.md
Last active June 22, 2023 02:23
Setup UNMS and Unifi network controller on Raspberry pi 4 Raspbian buster

Setup Raspbian Buster

I'm using debian 10 as my daily so these are *nix commands. Mac should work with these too but you're on your own if you're using Windows. Goal for me is to make a headless raspberry pi I can SSH into and connect to my network using Ethernet. You should be comfortable in command line if you choose to follow this guide.

  1. Go to https://www.raspberrypi.org/downloads/raspbian and download Raspbian lite archive
  2. unzip the image
  3. Plug in sdcard. Run lsblk to see drives and mount points. Likely, the sdcard will show up in /dev/sda or /dev/sdb and may have some partitions like /dev/sda1 and /dev/sda2.
  4. If partitions are mounted, unmount all of them. Ex: umount /dev/sda1 and umount /dev/sda2
  5. Copy the raspbian image to the sdcard with sudo dd if=RASPBIAN_IMAGE_FILE.img of=/dev/sda bs=4M
  6. Run sync to ensure the written contents are flushed
  7. OPTIONAL: To start ssh server on boot, Unplug sdcard and reinsert to remount new partitions. You'll have two with raspbian.
@codeniko
codeniko / Doze_Mode_Behavior.md
Created August 3, 2019 04:01 — forked from christophermark/Doze_Mode_Behavior.md
Android Marshmallow Idle Mode Behavior

What is "idle mode"?

Idle mode is a state where the phone has no network connectivity and apps are temporarily suspended. Idle mode gets triggered by one of two ways: an asleep, still, unplugged phone (Doze mode), and when an app has not been opened in a significant amount of time (App Standby Mode). During idle mode via Doze, the phone will wake up periodically for a short amount of time, allowing apps to run and use network connectivity. Using several different methods outlined below, it is possible to wake apps up during idle mode outside of these maintenance windows.

Time to enter Doze mode

1 hour of being still after the screen turns off.

Time to enter App Standby mode

TBD

Idle maintenance windows