Skip to content

Instantly share code, notes, and snippets.

View somat's full-sized avatar
🏠
Working from home

Akhmat Safrudin somat

🏠
Working from home
View GitHub Profile
try:
gpsd = gps.gps(mode=gps.WATCH_ENABLE)
while True:
# Read the GPS state from the laptop
gpsd.next()
if (gpsd.valid & gps.LATLON_SET) != 0:
print "Latitude: %s" % gpsd.fix.latitude
print "Longitude: %s" % gpsd.fix.longitude
@somat
somat / nginx.conf
Created October 27, 2017 11:26
Nginx http proxy with ssl example.
server {
listen 80;
server_name api.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name api.example.com;
ssl_certificate /etc/letsencrypt/live/api.example.com/fullchain.pem;
"""RNN Example."""
from __future__ import print_function, division
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
num_epochs = 100
total_series_length = 50000
truncated_backprop_length = 15
state_size = 4
"""Example RNN."""
from __future__ import print_function, division
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
num_epochs = 100
total_series_length = 50000
truncated_backprop_length = 15
state_size = 4
"""Example RNN."""
from __future__ import print_function, division
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
num_epochs = 100
total_series_length = 50000
truncated_backprop_length = 15
state_size = 4
@somat
somat / docker_rm_all
Created November 12, 2016 09:08
Remove all Docker containers
$ docker rm $(docker ps -a -q)
@somat
somat / fedora_pptp
Created November 10, 2016 06:44
Enable PPTP on Fedora
firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -p gre -j ACCEPT
firewall-cmd --direct --add-rule ipv6 filter INPUT 0 -p gre -j ACCEPT
firewall-cmd --reload
@somat
somat / isauth.js
Created October 21, 2016 10:35
Auth middleware, set layout for authenticated user.
var isAuth = function(req, res, next) {
if(req.user) {
res.locals.layout = 'app';
next();
} else {
res.redirect(res.locals.url.login);
}
}
module.exports = isAuth;
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
@somat
somat / nginx.conf
Created January 26, 2015 10:00
Nginx configuration for reverse proxy
server {
listen 80;
server_name domain.com;
location / {
proxy_pass http://localhost:8090/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}