Skip to content

Instantly share code, notes, and snippets.

Noval Agung Prayogo novalagung

Block or report user

Report or block novalagung

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@novalagung
novalagung / iptables-allow-ssh-http-https-from-certain-ip-but-block-all-others.sh
Last active Jul 10, 2019
iptables example to allow ssh, and block every incoming http and https requests except certain ips
View iptables-allow-ssh-http-https-from-certain-ip-but-block-all-others.sh
# allow incoming ssh access from anywhere
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# allow incoming http & https requests from local
sudo iptables -A INPUT -p tcp --dport 80 -s 127.0.0.1 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -s 127.0.0.1 -j ACCEPT
# allow incoming http & https requests from specific ips
sudo iptables -A INPUT -p tcp --dport 80 -s 13.250.120.208 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -s 13.250.120.208 -j ACCEPT
View mongodb_ssl_with_letsencrypt.md

#MongoDB 3.2.x SSL with Letsencrypt Letsencrypt is an initative which aims to increase the use of encryption for websites. It basically allows people to apply for free certificates provided that they prove the they control the requested domain. We will look at the what is needed to secure your MongoDB installation. For more details on setting up a MongoDB server see MongoDB 3.2.x.

##Set the hostname We sould to set the hostname to match the name of the certificate we are going to optain.

sudo hostname mongo0.example.com

Then update the hostname file to set the server name permanently.

@novalagung
novalagung / gist:a0fddc1d0161599572ee9871146d2992
Created May 14, 2019 — forked from sanatgersappa/gist:4030649
Querying Sharepoint on Office365 with Go
View gist:a0fddc1d0161599572ee9871146d2992
package main
import (
"fmt"
"io/ioutil"
"net/http"
"log"
"regexp"
"strings"
)
View blocking-akal2an.js
var vm = {}
vm.dataUser = []
vm.isDataUserReady = false
vm.doGetData = function() {
$.ajax({
url: "https://reqres.in/api/users?page=2"
}).then(function(res) {
setTimeout(() => {
vm.dataUser = res.data
View get-kurs.go
package main
import (
"fmt"
"net/http"
"strconv"
"strings"
"github.com/PuerkitoBio/goquery"
)
@novalagung
novalagung / using-callback.js
Last active Nov 15, 2018
a simple comparison on handling asynchronous processes sequentially, using callback vs promise, in javascript
View using-callback.js
function doA(callback) {
$.ajax({
// ...
success: function (res) {
if (callback) callback(res, true)
},
error: function (res) {
if (callback) callback(res, false)
}
})
@novalagung
novalagung / go-soap-wsdl-using-http.go
Last active Sep 4, 2019
Example implementation of making SOAP call on WSDL web service using go with only net/http package. The full tutorial avaiable on https://medium.com/eaciit-engineering/soap-wsdl-request-in-go-language-3861cfb5949e
View go-soap-wsdl-using-http.go
package main
import (
"bytes"
"crypto/tls"
"encoding/base64"
"encoding/xml"
"fmt"
"log"
"net/http"
View mgo-delete-all.js
// Get session
info := new(mgo.DialInfo)
info.Username = "username"
info.Password = "password"
info.Source = "admin"
info.Addrs = []string{"host"}
info.Database = "dbname"
session, err := mgo.DialWithInfo(info)
@novalagung
novalagung / ca.md
Created Jul 19, 2018 — forked from soarez/ca.md
How to setup your own CA with OpenSSL
View ca.md

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@novalagung
novalagung / app.js
Created Jan 23, 2018 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
View app.js
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
You can’t perform that action at this time.