Skip to content

Instantly share code, notes, and snippets.

View restureese's full-sized avatar
😊

Ariska Restu Ginanjar restureese

😊
  • Yogyakarta - Banjarnegara
View GitHub Profile
@restureese
restureese / update_multi_rows.py
Created February 26, 2020 03:41
SQLAlchemy update multiple rows
db.session.query(Model).\
filter(Model.id == id).\
update({Model.deleted_at:datetime.now()}, synchronize_session = False)
@restureese
restureese / readme.md
Created July 21, 2020 03:37 — forked from mowings/readme.md
ffmpeg stream and save video from Dahua 4300s IP Camera

Use ffmpeg to stream video from a dahua 4300s to a file or files

You can use ffmpeg to directly pull frames off of a dahua 4300s at full resolution. May be a good alternative to pricey dvrs which likely cannot record at full resolution, may not work with the camera, or are prohibitevly expensive

Simple Stream to file

Simple stream to file. Full resolution

ffmpeg -loglevel debug -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/live" \

-c copy -map 0 foo.mp4

@restureese
restureese / KongJwt.md
Created October 5, 2020 09:02 — forked from martinheld/KongJwt.md
Short example to use JWT with Kong

JWT Kong Example

  • Get and Start Kong and Co
git clone [email protected]:Mashape/docker-kong.git
cd docker-kong/compose
docker-compose up
  • Create Kong API Route
@restureese
restureese / longPolling.js
Created October 8, 2020 14:32 — forked from jasdeepkhalsa/longPolling.js
Simple Long Polling Example with JavaScript and jQuery by Tian Davis (@tiandavis) from Techoctave.com (http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery)
// Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast)
(function poll(){
$.ajax({ url: "server", success: function(data){
//Update your dashboard gauge
salesGauge.setValue(data.value);
}, dataType: "json", complete: poll, timeout: 30000 });
})();
@restureese
restureese / gist:e06dae6f528c710f9b6ffd37c5f906f5
Created November 23, 2020 08:25
Convert MySql to postgress
pgloader mysql://localhost/db postgresql://localhost:5432/db
@restureese
restureese / index.html
Created January 22, 2021 03:17
Create Polygon with fabric js
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script src="https://unpkg.com/[email protected]/dist/fabric.js"></script>
#!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -t nat -F
iptables -X
iptables -t nat -A PREROUTING -p tcp --dport 5000 -j DNAT --to-destination 192.168.100.101:5000
iptables -t nat -A POSTROUTING -j MASQUERADE
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition,showError);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
localStorage.setItem("lat", position.coords.latitude);
@restureese
restureese / search.js
Created June 24, 2021 09:28
Get object by value in array
var result = jsObjects.filter(obj => {
return obj.b === 6
})
@restureese
restureese / Nginx RTMP module on Ubuntu 18.04.md
Created July 21, 2021 09:21 — forked from amitkhare/Nginx RTMP module on Ubuntu 18.04.md
Nginx RTMP module on Ubuntu 18.04 with RTMPS support for Facebook live streaming Hardware and Software live-streaming encoders have typically used the RTMP streaming protocol. With the Facebook enforcement of the RTMPS encrypted live-stream some older hardware and software encoders can no longer work. By using the method below we can convert RTM…

update

sudo apt-get update
sudo apt-get upgrade

install nginx

sudo apt-get install nginx -y
sudo apt-get install libnginx-mod-rtmp -y