Skip to content

Instantly share code, notes, and snippets.

@iamnimnul
iamnimnul / backup.sh
Created February 14, 2025 17:11
uptime kuma - run docker script & backup script
#!/bin/bash -e
set -euxo pipefail
CONTAINER_NAME="uptime-kuma"
DATETIME="$(date -Ins)"
FILENAME="uptime-kuma-${DATETIME}.zip"
mkdir -p backup
docker exec ${CONTAINER_NAME} sh -c "apt update && apt install zip && mkdir -p /root/backup"
docker exec ${CONTAINER_NAME} sh -c "zip -r /root/backup/${FILENAME} /app/data"
docker cp ${CONTAINER_NAME}:/root/backup/${FILENAME} $(pwd)/backup/
@iamnimnul
iamnimnul / README.md
Last active February 9, 2025 10:15
Installing mega-cmd-server service on Debian 12 / Raspberry Pi OS

Install mega-cmd from official website https://mega.io/cmd#download. For Raspberry Pi use Linux > Raspbian.

To create background service:

# Create the service file (copy content)
# WARNING: UPDATE LINE 7 "User=root" if you want to run it as different user
sudo nano /etc/systemd/system/mega.service

# Set proper permissions
https://github.com/mayakyler/link-shorteners/blob/main/py-link-shorteners/link_shorteners/link-shorteners.txt
@iamnimnul
iamnimnul / git lol.md
Created July 24, 2023 16:54 — forked from Omerr/git lol.md
git lol - an alias to Git that shows the commit graph in a pretty format

log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

To configure as an alias git lol:

git config --global alias.lol "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)&lt;%an&gt;%Creset' --abbrev-commit"

#########################################################################################
# Name m00nie::youtube
# Description Uses youtube v3 API to search and return videos
#
# Version
# 3.1.2 - Added support for live urls
# 3.1.1 - Removed encoding converter, added support for shorts
# 3.1 - Yet more duration decoding fixes. Specific case of 00s videos less than
# an hour too. It also adds checks for videos <24 hours long (who knew)
# Hope this is the last of the duration crap
@iamnimnul
iamnimnul / copy_table.py
Created August 28, 2020 13:59 — forked from pawl/copy_table.py
Copy Schema Of A Remote Database Table To A New Local Table With SQLalchemy
from sqlalchemy import create_engine, Table, Column, Integer, Unicode, MetaData, String, Text, update, and_, select, func, types
# create engine, reflect existing columns, and create table object for oldTable
srcEngine = create_engine('mysql+mysqldb://username:[email protected]/database') # change this for your source database
srcEngine._metadata = MetaData(bind=srcEngine)
srcEngine._metadata.reflect(srcEngine) # get columns from existing table
srcTable = Table('oldTable', srcEngine._metadata)
# create engine and table object for newTable
destEngine = create_engine('mysql+mysqldb://username:password@localhost/database') # change this for your destination database
@iamnimnul
iamnimnul / PrivateRoute.jsx
Created November 5, 2019 11:32
PrivateRoute in react 16.11 react-router 5.1
function PrivateRoute({component: Component, isAuthenticated: isAuthenticated, ...rest}) {
return (
<Route
{...rest}
render={props => isAuthenticated ? (<Component {...props} />) : (<Redirect to={{pathname: "/login"}} />)}
/>
);
}
@iamnimnul
iamnimnul / ioncube_loader_lin64_7.1_10.3.5_190429.so
Last active April 29, 2019 15:58
php 7.1 - ioncube loader - alpine linux 64bit
This file has been truncated, but you can view the full file.
@iamnimnul
iamnimnul / ekg-password-recovery.sh
Created March 14, 2019 11:06
eksperymentalny klient gadu-gadu ekg - odzyskiwanie hasła
grep '^password ' .gg/config | cut -b 11- | base64 -d; echo
@iamnimnul
iamnimnul / ErrorFocus.jsx
Last active January 8, 2019 10:21 — forked from dphrag/ErrorFocus.jsx
Formik Scroll To First Invalid Element W/O Refs
import React from 'react';
import { connect } from 'formik';
class ErrorFocus extends React.Component {
componentDidUpdate(prevProps) {
const { isSubmitting, isValidating, errors } = prevProps.formik;
const keys = Object.keys(errors);
if (keys.length > 0 && isSubmitting && !isValidating) {
const selector = `[name="${keys[0]}"]`;
const errorElement = document.querySelector(selector);