Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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() {
import MediaPlayer
class ShutterSoundCanceller {
static func playShutterInvertSound() {
if let soundURL = Bundle.main.url(forResource: "photoShutterAntiSound", withExtension: "caf") {
do {
// Play sound even in silent mode
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, mode: AVAudioSessionModeMeasurement, options: [])
} catch {
print(error)
@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 / image-build.sh
Last active June 10, 2025 03:40
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 / 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"
@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 / pdnsd.conf
Last active April 18, 2016 10:02
pdnsd.conf for openwrt
global {
perm_cache=2048;
cache_dir="/var/pdnsd";
# pid_file = /var/run/pdnsd.pid;
run_as="nobody";
server_ip = 0.0.0.0; # Use eth0 here if you want to allow other
# machines on your network to query pdnsd.
server_port = 25252;
status_ctl = on;
# paranoid=on; # This option reduces the chance of cache poisoning
@HackingGate
HackingGate / MetadataObjectTypes.swift
Last active September 7, 2015 03:14
All iOS Available Metadata Object Types
// Available types : https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVMetadataMachineReadableCodeObject_Class/index.html#//apple_ref/doc/constant_group/Machine_Readable_Object_Types
import AVFoundation
let metadataObjectTypes = [
AVMetadataObjectTypeUPCECode,
AVMetadataObjectTypeCode39Code,
AVMetadataObjectTypeCode39Mod43Code,
AVMetadataObjectTypeEAN13Code,
AVMetadataObjectTypeEAN8Code,
AVMetadataObjectTypeCode93Code,