Skip to content

Instantly share code, notes, and snippets.

View alazycoder101's full-sized avatar

Lazy coder alazycoder101

View GitHub Profile
@alazycoder101
alazycoder101 / send_email.sh
Last active December 25, 2022 12:55
bash function to send email via sendgrid
send_email() {
# sendgrid api key
API_KEY=$mykey
to=$1
from=$2
subject=$3
content=$4
JSON_FORMAT='{"personalizations": [{"to": [{"email": "%s"}]}],"from": {"email": "%s"},"subject": "%s","content": [{"type": "text/plain", "value": "%s"}]}\n'
data=$(printf "$JSON_FMT" "$to" "$from" "$subject" "$content")
curl --request POST \
.tracks[]|"wget `curl -H 'appvers: 1.0.15.10102924' -H 'baseapi: 23' -H 'basever: 1.0.15.10102924' -H 'beta: 0' -H 'channel: 0' -H 'channelid: 0' -H 'osver: 10.0.1' -H 'skey: pZw4DtHy' -H 'user-agent: Whear/1.0.15 WHBrand/xiaomi Dalvid/2.1.0 (Linux; U; Android 10.0.1; Redmi Note 8 Build/MRA58K)' -H 'vid: 2319074' -H 'wrts_listentime: 0' -H 'wrts_signature: 1623431083_1621078395_eeabecbf444e0e50fcdb7f' 'https://i.at.qq.com/getplayinfo?trackId=" + .trackId + "&type=0&model='|jq -r '.url'` -O " + .title + ".m4a"
#!/usr/bin/perl
#Filename: FlashVideoCapture.pl
use strict;
##################################################
# Setup the variables
##################################################
my $PROGNAME = $0; $PROGNAME =~ s|.*/||;
my $LSOF = 'lsof';
@alazycoder101
alazycoder101 / current-time-in-millisecond.html
Created January 9, 2022 15:48
show current time for audio/video in millisecond
<!-- https://pretagteam.com/question/html5-display-audio-currenttime -->
<div>
<audio id="track" src="https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3" ontimeupdate="document.getElementById('tracktime').innerHTML = this.currentTime.toFixed(2) + ' / ' + this.duration.toFixed(2);" controls="controls">
<p>Your browser does not support the audio element</p>
</audio>
<span id="tracktime">0 / 0</span>
</div>
<div>
@alazycoder101
alazycoder101 / bubble-sort.rb
Created December 17, 2021 16:19
Bubble sort with given block in Ruby
class Array
def bubble_sort!
sorted = false
while !sorted
sorted = true
(0...self.length - 1).each do |index|
comparison = if block_given?
yield self[index], self[index+1]
else
self[index] > self[index + 1]
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="grab bandwidth from Network Information.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Network Information</title>
<style>
@alazycoder101
alazycoder101 / mongo-headless.yml
Created October 23, 2021 09:16
mongo headless service
apiVersion: v1
kind: Service
metadata:
name: mongo
labels:
name: mongo
spec:
ports:
- port: 27017
targetPort: 27017
@alazycoder101
alazycoder101 / mongo-deployment.yml
Created October 23, 2021 09:15
mongo deployment in k8s
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongo
spec:
selector:
matchLabels:
role: mongo
environment: production
serviceName: "mongo"
@alazycoder101
alazycoder101 / busybox-pod.yml
Created October 23, 2021 09:12
busybox pod to debug
# debugger.yaml
kind: Pod
apiVersion: v1
metadata:
name: toolkit
spec:
volumes:
- name: volume-to-debug
persistentVolumeClaim:
claimName: postgres-data-0
@alazycoder101
alazycoder101 / pgpool-deployment.yml
Created October 23, 2021 09:08
pgpool deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: pgpool
labels:
app: pgpool
spec:
replicas: 1
selector:
matchLabels: