Skip to content

Instantly share code, notes, and snippets.

View amirulabu's full-sized avatar
🕸️
mirul.xyz

Amirul Abu amirulabu

🕸️
mirul.xyz
View GitHub Profile
@amirulabu
amirulabu / luno_bitcoin_BTCMYR.sh
Created July 22, 2017 05:31
a simple bitcoin to MYR ticker using bash, curl, jq
#!/bin/bash
# install curl and jq
while [ true ]
do
curl -s https://api.mybitx.com/api/1/ticker?pair=XBTMYR | jq -r '.bid'
sleep 10
done
import tkinter as tk
from tkinter import ttk
import urllib.request
import json
import schedule, time
def get_luno():
req = urllib.request.urlopen("https://api.mybitx.com/api/1/ticker?pair=XBTMYR")
x = json.loads(req.read().decode("utf-8"))
req.close()
@amirulabu
amirulabu / config
Last active August 13, 2017 16:41
Attempt to use twitter for generating random numbers
#no 'string quotes please'
[twitter]
CONSUMER_KEY=xxxxxxxxxxxx
CONSUMER_SECRET=xxxxxxxxxxxx
ACCESS_TOKEN=xxxxxxxxxxxx
ACCESS_TOKEN_SECRET=xxxxxxxxxxxx
@amirulabu
amirulabu / script.js
Created September 16, 2017 12:51
uploading images to imgur using jquery
var form = new FormData();
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.imgur.com/3/image",
"method": "POST",
"headers": {
"authorization": "Client-ID YOUR_CLIENT_ID"
},
"processData": false,
@amirulabu
amirulabu / robotmaidfsm.py
Created November 20, 2018 12:39
an example of finite state machine from this youtube video https://www.youtube.com/watch?v=E45v2dD3IQU
from random import randint
from time import clock
class Transition(object):
def __init__(self,toState):
self.toState = toState
def execute(self):
print("--Transitioning-- to %s" % self.toState)
@amirulabu
amirulabu / check_server.py
Created February 7, 2019 00:11
A simple telegram bot that notifies whether some website is up or not. Install requests library, setup crontab and your done!
#!/usr/bin/python3
import requests
r = requests.get('<your website>')
if r.status_code is 200:
r = requests.post(
'https://api.telegram.org/bot<your telegram bot token>/sendMessage',
data = {'chat_id':<your telegram chat id>,'text':'Good news, Status code for %s is %s' % (r.url,r.status_code),
'disable_notification': True}
const props = {
className: 'container',
children: 'Hello World'
}
const element = <div className={props.className} children={props.children} />
const element1 = <div {...props}/>
const element2 = <div className="my-class" {...props}/>
@amirulabu
amirulabu / main.go
Last active April 2, 2019 10:29
gowasep - its like wasap.my, but built using go - demo at wasep.mirul.xyz
package main
import (
"flag"
"fmt"
"net/http"
"regexp"
)
var phoneNumberLink = regexp.MustCompile(`^/\+?\d+$`)
Happy Monday Amirul!
This week you'll be working with Ann-Marie, the president of her local honor society. Her honor society meets every week in groups of about 30 people, led by a group leader. The honor society has two kinds of members, regular members that everybody starts as, and exceptional members.
In order to become an exceptional member someone has to
Be a member for at least 2 years
Do 100 hours of community service
Be nominated by their group leader
Be elected by at least 50% of the group.
// trying to translate c++ codes to dart
// http://gameprogrammingpatterns.com/command.html#configuring-input
void main() {
print("Starting game\n");
JumpCommand jumpCommand = JumpCommand();
FireCommand fireCommand = FireCommand();
WalkCommand walkCommand = WalkCommand();
BlockCommand blockCommand = BlockCommand();