Skip to content

Instantly share code, notes, and snippets.

View ans-4175's full-sized avatar

Ahmad Anshorimuslim Syuhada ans-4175

View GitHub Profile
object HelloWorld {
def main(args: Array[String]) {
val listKopi = List("Noah’s Barn Coffenery","Two Hands Full","Yellow Truck","Jack Runner Roastery","Kopi Anjis","Blue Doors","Rumah kopi","Cups Coffee & Kitchen","Kopi Lamping","Lacamera Coffee","Two Cents","Kopi Selasar Sunaryo","Kopi Gesang Café","Kedai Kopi Mata Angin","Kopi Ireng","Coffe And John")
val r = scala.util.Random
println(listKopi(r.nextInt(listKopi.size)))
}
}
@ans-4175
ans-4175 / throttle_request
Created January 18, 2016 04:19
Wrap for request using Promise and throttle-exec
var ThrottleEngine = require("throttle-exec")
var Promise = require("when/es6-shim/Promise")
var Request = require("request")
var throttlingCount = 10
var ThrottleInstance = new ThrottleEngine(throttlingCount)
var Engine = function(param){
return ThrottleInstance.registerAction("request",[param])
}
@ans-4175
ans-4175 / netcat.conf
Created March 17, 2016 06:46
netcat beginning flume conf
# Name the components on this agent
Agent1.sources = netcat-source
Agent1.channels = memory-channel
Agent1.sinks = logger-sink
# Describe/configure Source
Agent1.sources.netcat-source.type = netcat
Agent1.sources.netcat-source.bind = localhost
Agent1.sources.netcat-source.port = 44444
#!/bin/bash
sudo su
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
#sudo update-grub
echo Success update kernel
@ans-4175
ans-4175 / fcm-push-notif.js
Last active July 2, 2016 01:51
Example Using of fcm-push-notif modules https://github.com/eFishery/fcm-push-notif
var FCM = require('fcm-push-notif');
var serverKey = 'firebase_server_key';
var fcm = new FCM(serverKey);
var message = {
to: '/topics/news', // required could be topic url or device registration token
collapse_key: 'your_collapse_key',
data: {
message: 'This is data message'
@ans-4175
ans-4175 / csrf-in-laravel.php
Created July 29, 2016 08:07
larave-csrf-method
/**
* Determine if the session and input CSRF tokens match.
*
* @param \Illuminate\Http\Request $request
* @return bool
*/
protected function tokensMatch($request)
{
$sessionToken = $request->session()->token();
@ans-4175
ans-4175 / wifipwd
Last active May 6, 2017 14:41
Bashscript for check wifi password on Linux
#!/bin/bash
sudo cat /etc/NetworkManager/system-connections/"$*" | grep "psk=" | cut -d'=' -f2
@ans-4175
ans-4175 / etc-hosts
Created June 12, 2017 11:42
List of /etc/hosts for Indonesian neetwork
23.235.33.217 vimeo.com
23.235.33.217 www.vimeo.com
23.235.33.217 developer.vimeo.com
23.235.33.217 api.vimeo.com
23.235.33.217 player.vimeo.com
151.101.9.140 reddit.com
151.101.9.140 www.reddit.com
151.101.9.140 np.reddit.com
151.101.9.140 m.reddit.com
54.174.14.76 out.reddit.com
@ans-4175
ans-4175 / User Setting
Created June 22, 2018 01:07
Personal vscode user's setting
{
"editor.fontSize": 12,
"window.zoomLevel": 0,
"window.menuBarVisibility": "toggle",
"workbench.colorCustomizations": {
"statusBar.background": "#34353a"
},
"window.restoreFullscreen": true,
"window.newWindowDimensions": "fullscreen"
// "window.newWindowDimensions": "maximized"
@ans-4175
ans-4175 / ImplementStore.js
Last active December 17, 2022 20:00
Implementation PouchyStore Draft
import PouchStore from 'PouchStore';
import config from 'config';
class ImplementStore extends PouchStore {
get name() {
return this._name;
}
setName(userId) {
this._name = `db_${userId}`;