Skip to content

Instantly share code, notes, and snippets.

@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.
#!/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 / cf-ddns.sh
Last active December 28, 2019 04:46 — forked from benkulbertis/cloudflare-update-record.sh
Cloudflare API v4 Dynamic DNS Update for both IPv4 and IPv6 in Bash
#!/bin/bash
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
# CHANGE THESE
auth_email="user@example.com"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # find in cloudflare account settings
record_name="www.example.com"
zone_identifier="023e105f4ecef8ad9ca31a8372d0c353" # get zone ID via API and store it here
record_identifier_ipv4="372e67954025e0ba6aaa6d586b9e0b59" # use List DNS Records api to get record id, link below ↓
@HackingGate
HackingGate / pcap-dnsproxy-watchdog.sh
Created February 1, 2016 04:11
A watchdog for Pcap-DNSProxy on OpenWrt
PROG=/usr/sbin/Pcap_DNSProxy
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
if [ $(ps|grep ${PROG}|grep -v grep|wc -l) -ge 1 ]; then
echo "['$LOGTIME'] Pcap_DNSProxy is running, PID is $(pidof ${PROG##*/})"
else
echo "['$LOGTIME'] Pcap_DNSProxy is not running."
/etc/init.d/pcap-dnsproxy start
fi
@HackingGate
HackingGate / cf-dev-mode.sh
Last active July 2, 2019 15:08
Quickly turn on CloudFlare development mode when incident happens
# 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
@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)
#!/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
// 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 / Fastfile
Created February 22, 2019 12:56
A fastlane/Fastfile example: resign Electra ipas using you own Apple Developer account
platform :ios do
desc "Resign Electra iOS ipa"
lane :resign_ios do
resign(
ipa: "Electra1141-1.3.2.ipa",
signing_identity: "iPhone Distribution: Luka Mirosevic (0123456789)",
provisioning_profile: "Electra_iOS.mobileprovision",
)
end
end
@HackingGate
HackingGate / set-himawari-wallpaper.sh
Last active May 6, 2019 08:20
Set himawari wallpaper shell script for macOS. (Linux & Windows not tested)
#!/bin/bash
PATH=$PATH:/usr/local/bin
echo `date`
echo "Checking himawari"
if ! type himawari > /dev/null; then
echo "Install himawari with:"
echo
echo "brew install imagemagick"
@HackingGate
HackingGate / himawari.js
Last active October 24, 2018 00:05
Set latest himawari earth dynamic wallpaper in every 10 minutes for macOS (ひまわり8号リアルタイム壁紙)
const { exec } = require('child_process');
var glob = require("glob")
var cronTime = '*/10 * * * *';
CronJob = require('cron').CronJob;
var job = new CronJob({
cronTime: cronTime,
onTick: function() {
@HackingGate
HackingGate / cocoapods_aliases
Last active October 12, 2018 13:45
CocoaPods Aliases
# CocoaPods aliases
alias pod_install_quick="pod install --no-repo-update"
alias pod_update_quick="pod update --no-repo-update"
alias pod_repo_update="pod repo update"