Skip to content

Instantly share code, notes, and snippets.

@HackingGate
HackingGate / sensors.py
Last active April 25, 2024 11:28
My environment temperature calculation for https://github.com/srob/homebridge-sensehat
#!/usr/bin/python
from sense_hat import SenseHat
import os
def get_cpu_temp():
res = os.popen('vcgencmd measure_temp').readline()
return float(res.replace("temp=", "").replace("'C\n", ""))
@HackingGate
HackingGate / image-build.sh
Last active March 14, 2024 08:56
upgrade ipk on OpenWrt
VERSION=19.07.7
# Download imagebuilder for R7800.
aria2c -c -x4 -s4 https://downloads.openwrt.org/releases/${VERSION}/targets/ipq806x/generic/openwrt-imagebuilder-${VERSION}-ipq806x-generic.Linux-x86_64.tar.xz
# Extract & remove used file & cd to the directory
tar -xvf openwrt-imagebuilder-${VERSION}-ipq806x-generic.Linux-x86_64.tar.xz
rm openwrt-imagebuilder-${VERSION}-ipq806x-generic.Linux-x86_64.tar.xz
cd openwrt-imagebuilder-${VERSION}-ipq806x-generic.Linux-x86_64/
@HackingGate
HackingGate / restore_last_git_modified_time.sh
Last active March 13, 2024 10:27
Retrieve and set the last modification date of all files in a git repository. Solution for https://stackoverflow.com/a/55609950/4063462
#!/bin/sh -e
OS=${OS:-`uname`}
if [ "$OS" = 'Darwin' ]; then
get_touch_time() {
date -r ${unixtime} +'%Y%m%d%H%M.%S'
}
else
# default Linux
@HackingGate
HackingGate / ubuntu-setup.sh
Last active February 23, 2024 23:51
My Ubuntu Desktop Setup
# Make Ubuntu use local time (Fix Windows 10 dual boot different time issue)
timedatectl set-local-rtc 1 --adjust-system-clock
# Check current settings
timedatectl
# Install packages
sudo apt update
sudo apt upgrade -y
sudo apt install emacs vim curl wget git build-essential -y
const crossConcatReducer = (acc, cur, idx) => {
const gap = idx + 1;
cur.forEach((element, i) => {
const indexToInsert = (i + 1) * gap - 1;
acc.splice(indexToInsert, 0, element);
});
return acc;
};
@HackingGate
HackingGate / adb-dns.bat
Created September 19, 2023 11:48 — forked from sharunkumar/adb-dns.bat
Enabling / Disabling private DNS in android via ADB
rem to disable private dns
adb shell settings put global private_dns_mode off
rem to enable private dns with hostname (example with dns.adguard.com)
adb shell settings put global private_dns_mode hostname
adb shell settings put global private_dns_specifier dns.adguard.com
@HackingGate
HackingGate / oracle-wireguard-server.sh
Created April 17, 2021 12:13
WireGuard server on Oracle Cloud Always Free Compute Instance
# WIP
# The script is compatible with Canonical Ubuntu (Always Free Eligible) Minimal
sudo apt update
sudo apt install wireguard
# ifconfig to check your interfae
# for Ubuntu 20.04 Minimal 2021.03.25-0 it's ens3
# Generate keys (WIP)

Sources I receive information

A list of my sources

General

General news list

Global

@HackingGate
HackingGate / tweet_lookup_statuses.py
Last active April 19, 2022 02:58
Have I retweeted or liked a tweet? Check tweet status by ids.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tweepy, sys
#enter the corresponding information from your Twitter application:
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_KEY = ''
ACCESS_SECRET = ''
@HackingGate
HackingGate / .customrc.sh
Last active March 31, 2022 09:57
git incremental clone
#####
alias pc4=proxychains4
#####
git_incremental_clone()
{
REPO=$1
DIR=$2
git clone --recurse-submodules $REPO $DIR --depth=1
cd $DIR