Skip to content

Instantly share code, notes, and snippets.

View infomation.md

Sources I receive information

A list of my sources

General

General news list

Global

@HackingGate
HackingGate / ubuntu-setup.sh
Last active May 4, 2023 13:03
My Ubuntu Desktop Setup
View ubuntu-setup.sh
# 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
@HackingGate
HackingGate / oracle-wireguard-server.sh
Created April 17, 2021 12:13
WireGuard server on Oracle Cloud Always Free Compute Instance
View oracle-wireguard-server.sh
# 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)
@HackingGate
HackingGate / convertToMP4.sh
Created December 9, 2020 03:31
Use ffmpeg to convert multiple videos(in any path) to MP4. Output in the same filename in the current path.
View convertToMP4.sh
#!/bin/bash
FILEPATH=""
for arg in $@
do
FILEPATH="${FILEPATH}${arg}"
if [[ -f $FILEPATH ]]; then
echo "Converting $FILEPATH to mp4"
FILENAME_W_EXTENSION=$(basename "$FILEPATH")
FILENAME="${FILENAME_W_EXTENSION%.*}"
@HackingGate
HackingGate / sensors.py
Last active June 7, 2023 17:43
My environment temperature calculation for https://github.com/srob/homebridge-sensehat
View sensors.py
#!/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 / cf-dev-mode.sh
Last active July 2, 2019 15:08
Quickly turn on CloudFlare development mode when incident happens
View cf-dev-mode.sh
# You need jq and curl installed:
# sudo apt install jq curl -y
#!/bin/bash
# CHANGE THESE
auth_email="user@example.com"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # find in cloudflare account settings
zone_identifier="023e105f4ecef8ad9ca31a8372d0c353" # get zone ID via API
# Get zone ID
View testMailgunWebhook.swift
// Test Webhook
// https://app.mailgun.com/app/webhooks
// WTFPL License
import Foundation
// Postbin URL
let urlString = "http://bin.mailgun.net/d806fafc"
// Sample Parameter: signature
@HackingGate
HackingGate / restore_last_git_modified_time.sh
Last active December 30, 2022 21:33
Retrieve and set the last modification date of all files in a git repository. Solution for https://stackoverflow.com/a/55609950/4063462
View restore_last_git_modified_time.sh
#!/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 / .customrc.sh
Last active March 31, 2022 09:57
git incremental clone
View .customrc.sh
#####
alias pc4=proxychains4
#####
git_incremental_clone()
{
REPO=$1
DIR=$2
git clone --recurse-submodules $REPO $DIR --depth=1
cd $DIR
@HackingGate
HackingGate / ec2-renew-ip.sh
Last active June 28, 2019 02:12
AWS EC2 renew IPv4 address by stop-wait-start instance. (no Elastic IPs needed)
View ec2-renew-ip.sh
#!/bin/bash
# From AWS doc
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html
# We release your instance's public IP address when it is stopped or terminated.
# Your stopped instance receives a new public IP address when it is restarted.
PATH=$HOME/.local/bin:$PATH
instace_ids="i-1348636c" #change it