Skip to content

Instantly share code, notes, and snippets.

@mike-cumulus
mike-cumulus / win11_wsl2_docker_git_2022.md
Last active October 12, 2023 17:57
Installing WSL2, Docker, SSH, and Git on Windows 11
@benigumocom
benigumocom / debug_from_qr.py
Last active April 30, 2025 22:09
Connect Wireless Debug from Terminal on Android11
#!/usr/bin/env python3
"""
Android11
Pair and connect devices for wireless debug on terminal
python-zeroconf: A pure python implementation of multicast DNS service discovery
https://github.com/jstasiak/python-zeroconf
"""
@siamware
siamware / Office_kms
Created July 13, 2019 07:07 — forked from CHEF-KOCH/KMS_office.cmd
KMS server Windows
cd\Program Files\Microsoft Office\Office16
cd\Program Files (x86)\Microsoft Office\Office16
cscript OSPP.VBS /sethst:kms.digiboy.ir
cscript OSPP.VBS /actcscript OSPP.VBS /dstatus
slmgr.vbs /ckms
@klingtnet
klingtnet / how-to-upgrade-nvmw-ssd-firmware-on-linux.md
Last active January 25, 2025 23:19
How to upgrade [Lenovo] NVMe SSD firmware on Linux

The instructions were tested on a Lenovo X1 Carbon 5th Gen (X1C5) on Arch Linux but should be applicable to other Lenovo models and Linux distributions.

BACKUP YOUR DATA! I created a bootable Ubuntu Image like this:

$ sudo sh -c 'curl --location --silent --fail "http://releases.ubuntu.com/18.04/ubuntu-18.04.1-desktop-amd64.iso" | pv > /dev/<your-usb-drive>'
# note that pv is only there to show progress, it is perfectly fine to redirect curl to the usb drive directly.

then I booted from this drive by pressing F12 on reboot and dumped my NVMe disk to an external hard drive like this:

@mvervuurt
mvervuurt / TimeDiff.scala
Created August 9, 2017 12:10
TimeDiff based on OffsetDateTime
val endDateTimeOffset = endDateTime.getOffset.toString
//Create OffsetDateTime in chosen timezone with correct Offset
val startDateTime = OffsetDateTime.now(ZoneId.of(endDateTimeOffset))
val timeDiff = ChronoUnit.HOURS.between(startDateTime, endDateTime)
@vertigra
vertigra / send_bot_to_private_shanel.md
Last active August 23, 2024 14:37
Отправка сообщений в приватный канал ботом телеграм

Отправка сообщений в приватный канал ботом телеграм

  • создать публичный канал
  • добавить в канал бота от которого будут посылаться сообщения
  • перейти по ссылке:
https://api.telegram.org/bot255854462:ABGlRhNICpcjb1EUbvMsagKyxPv3Z1FPtXA/sendMessage?chat_id=-1221196120949&text=test_message_string
  • в ответе придет id канала
@pbaisla
pbaisla / proxy.sh
Last active March 14, 2017 13:29
Script to set system proxy on Linux
#
# Place this script inside /etc/profile.d/ to set proxy on log in
# AND
# Copy-paste in to your ~/.bashrc to switch between proxies easily in shells
#
#
# DEFAULTS
#
# Set default proxy details here. Eg.
@erikwj
erikwj / StreamingExcel.scala
Created September 3, 2015 07:16
create large excel files
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import java.io.FileOutputStream
import java.io.File
@matriphe
matriphe / ssh-telegram.sh
Last active April 16, 2025 20:24
Bash Script to notify via Telegram Bot API when user log in SSH
# save it as /etc/profile.d/ssh-telegram.sh
# use jq to parse JSON from ipinfo.io
# get jq from here http://stedolan.github.io/jq/
USERID="<target_user_id>"
KEY="<bot_private_key>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt'
if [ -n "$SSH_CLIENT" ]; then
@smoser
smoser / ubuntu-cloud-virtualbox.sh
Last active July 5, 2024 09:33
example of using Ubuntu cloud images with virtualbox
## Install necessary packages
$ sudo apt-get install virtualbox-ose qemu-utils genisoimage cloud-utils
## get kvm unloaded so virtualbox can load
$ sudo modprobe -r kvm_amd kvm_intel
$ sudo service virtualbox stop
$ sudo service virtualbox start
## URL to most recent cloud image of 12.04
$ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"