Skip to content

Instantly share code, notes, and snippets.

View goFrendiAsgard's full-sized avatar

Go Frendi Gunawan goFrendiAsgard

View GitHub Profile
#!/bin/sh
# menampilkan Hello world
echo "Hello world"
# declare variable NAME
NAME="Setya Novanto"
# menampilkan isi variable
echo ${NAME}
#!/bin/sh
CURRENT_DATE=$(date +"%Y-%m-%d")
for FILENAME in $(ls | grep '\.java$')
do
cp ${FILENAME} ${FILENAME}.${CURRENT_DATE}.bak
done
@goFrendiAsgard
goFrendiAsgard / main.go
Created September 18, 2019 06:40
force download
package main
import (
"fmt"
"io"
"net/http"
)
func serve(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/octet-stream")
@goFrendiAsgard
goFrendiAsgard / gateway.go
Last active June 12, 2019 12:12
myproject
package main
import (
"github.com/goFrendiAsgard/myproject/gen"
)
func init() {
// define gateway
gateway := gen.NewEmptyGateway(&Gen,
@goFrendiAsgard
goFrendiAsgard / txt
Last active March 27, 2019 11:41
apache-spark error
[guldan@draenor ~]$ spark-shell
/usr/bin/hadoop
WARNING: HADOOP_SLAVES has been replaced by HADOOP_WORKERS. Using value of HADOOP_SLAVES.
2019-03-27 18:34:29 WARN NativeCodeLoader:60 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Setting default log level to "WARN".
package main
import (
"fmt"
"net/http"
)
type EventMessage struct {
Event string
Message interface{}
}
function ajax(obj) {
setTimeout(function () {
obj.success(obj.url);
}, 100);
}
let x; // 1
ajax({ // 2
url: "http://google.com",
@goFrendiAsgard
goFrendiAsgard / Example.php
Created October 22, 2018 01:11
Eloquent example
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Flight extends Model
{
/**
* The table associated with the model.
@goFrendiAsgard
goFrendiAsgard / coba.rs
Created October 12, 2018 02:41
First experience with rust
// filename: coba.rs
// compile: rustc coba.rs
// run: ./coba
// compile and run: rustc coba.rs && ./coba
use std::io;
fn main() {
let stdin = io::stdin();
@goFrendiAsgard
goFrendiAsgard / koa-promise.js
Created June 24, 2018 03:01
Using promise and async in Koa
const Koa = require('koa');
const app = new Koa();
function middleWare1 (ctx, next) { // This is a function that return a promise
return new Promise((resolve, reject) => {
ctx.body = 'Hello';
next().then(resolve).catch(reject);
})
}