Skip to content

Instantly share code, notes, and snippets.

[Unit]
Description=Rathole Service
After=network.target
[Service]
Type=simple
User=ec-user
Restart=on-failure
RestartSec=5s
ExecStart=/home/ec-user/rathole /home/ec-user/server.toml
delete FROM apns_master WHERE id IN (SELECT id FROM (SELECT id, token, updated, ROW_NUMBER() OVER w AS rnum FROM apns_master WINDOW w AS (PARTITION BY token ORDER BY updated DESC)) t WHERE t.rnum > 1);
@vjyanand
vjyanand / Auto
Last active November 1, 2022 03:06
setInterval(function() {let likeb = document.querySelector('[data-testid="gamepadLike"]');if (likeb) {likeb.click()}}, 2000)
sudo yum install cups-libs dbus-glib libXrandr libXcursor libXinerama cairo cairo-gobject pango gtk3-devel alsa-lib libXScrnSaver git-core memcached nodejs cargo openssl-devel
ps -O etimes -eo pid,etime,comm,user,tty | grep chrome | grep -v grep | awk {'if ($2 > 100) print $1'} | xargs kill
@vjyanand
vjyanand / gist:fdf02baa573436741c17
Last active February 3, 2016 03:15
selenium webdriver chrome headless
export DISPLAY=:10
Xvfb :10 -screen 0 5120x2880x24 -ac &
google-chrome --start-maximized --remote-debugging-port=9222 &
cd /usr/local/bin
nohup java -jar ./selenium-server-standalone-2.50.1.jar &
@vjyanand
vjyanand / gist:38b7286dfdc0d0670285
Created February 1, 2016 10:27
fade in fade out
let avUrlAsset = AVAsset(URL: _url)
let duration = avUrlAsset.duration
let durationInSeconds = CMTimeGetSeconds(duration)
let item = AVPlayerItem(asset: avUrlAsset, automaticallyLoadedAssetKeys:["duration"])
let params = AVMutableAudioMixInputParameters(track: avUrlAsset.tracks.first! as AVAssetTrack)
let firstSecond = CMTimeRangeMake(CMTimeMakeWithSeconds(0, 1), CMTimeMakeWithSeconds(15, 1))
let lastSecond = CMTimeRangeMake(CMTimeMakeWithSeconds(durationInSeconds - 1, 1), CMTimeMakeWithSeconds(1, 1))
params.setVolumeRampFromStartVolume(0, toEndVolume: 1, timeRange: firstSecond)
params.setVolumeRampFromStartVolume(1, toEndVolume: 0, timeRange: lastSecond)
let mix = AVMutableAudioMix()
@vjyanand
vjyanand / gist:9ff5628e92dde25522e2
Last active January 30, 2016 06:20
smartos ipv6
svcadm enable ndp
ifconfig bge0 inet6 plumb
ifconfig bge0 inet6 addif 2607:f128:0421:0081:0732:0003:1208:3300/64 up
route add -inet6 2607:f128:0421:0081::1 2607:f128:0421:0081:0732:0003:1208:3300 -interface
route add -inet6 default 2607:f128:0421:0081::1
dladm create-bridge six
dladm create-etherstub stub2
dladm set-linkprop -p mtu=1500 stub2
@vjyanand
vjyanand / install.sh
Created December 10, 2015 12:55
Installing tesseract on SmartOS
git clone https://github.com/tesseract-ocr/tesseract.git
cd tesseract/
pkgin in autoconf automake libtool
wget "http://www.leptonica.com/source/leptonica-1.72.tar.gz"
cd leptonica-1.72
CFLAGS="-D__SOLARIS__"
./configure --prefix=/opt/local
make && make install
cd ..
export LIBLEPT_HEADERSDIR=/tmp/tesseract/leptonica-1.72/src
openssl pkcs12 -nocerts -out aps_private-key.pem -in aps_private-key.p12
openssl x509 -in aps_development.cer -inform der -out aps_development.pem
openssl pkcs12 -export -in aps_development.pem -out aps_dev_credentials.p12 -inkey aps_private-key.pem