Skip to content

Instantly share code, notes, and snippets.

View shahril96's full-sized avatar
🐢

Mohd Shahril shahril96

🐢
View GitHub Profile
@shahril96
shahril96 / A.py
Created May 12, 2018 14:33
eat.code.error.cry.repeat's (some) solutions for ACM ICPC Al-Khawarizmi 2018
while True:
N, M = map(int, input().split())
if N == 0 and M == 0:
break
table = [i for i in range(1, N+1)]
@shahril96
shahril96 / api.php
Created May 3, 2018 16:25
Twitter's tweet live counter (works as 4-may-2018)
<?php
$link = "https://twitter.com/memanskywalker/status/991649182090903552";
$headers = [
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language: en-US,en;q=0.5",
"Cache-Control: no-cache",
"Connection: keep-alive",
"DNT: 1",
@shahril96
shahril96 / boolean_evaluator.py
Created April 17, 2018 12:54
A simple script that uses .eval() function to evaluate an expression containing boolean values.
'''
Logic expression evaluation.
Examples:
1) a and b or c
2) a and (c or (c and d and e))
3) ((b and c) and c) or a
@shahril96
shahril96 / domjudge-setup.sh
Last active July 19, 2023 14:31
A helper script to automatically setup a DOMjudge server in 10 minutes, go get yourself a coffee.
#!/usr/bin/env bash
#
# This is a script that can automatically
# setup DOMjudge server & judgehost, inside a same server.
#
# As a bonus, this script will also setup a beautiful DOMjudge
# interface made using React, which it will listen on port 8080.
#
# This script assumes that:
@shahril96
shahril96 / fifa17.ipynb
Last active December 12, 2017 01:53
FIFA'17 dataset analysis
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shahril96
shahril96 / judgehost.service
Last active November 11, 2017 22:30
Systemd unit service for DOMJudge's judgehost
[Unit]
Description=DOMJudge's judgehost service
After=mysql.service
[Service]
ExecStart=/home/shahril/domjudge/judgehost/bin/judgedaemon
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=forking
@shahril96
shahril96 / gist-clone-all.py
Last active July 12, 2017 11:56
Clone all gist from specified account (requires Requests)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Clone all gists of GitHub username given on the command line."""
import subprocess
import sys
import requests
if len(sys.argv) > 1:
gh_user = sys.argv[1]
@shahril96
shahril96 / rss.py
Last active July 2, 2017 20:56
Python script to fetch, parse and display RSS titles (intended to be used with reddit's netsec)
#!/usr/bin/env python
import sys
import re
import textwrap
try: import urllib.request as urllib_request # for python 3
except ImportError: import urllib2 as urllib_request # for python 2
try: from html.parser import HTMLParser # for python 3
@shahril96
shahril96 / block-mac.py
Last active June 26, 2017 10:42
Automatically block all wireless clients in the router (only for D-Link DSL-2640B)
'''
Note:
Sometimes when you have too many cousin celebrating
Eid Al-Fitr in your house, with the limited and slow internet, thing
can go rage fast.
Here is the script, to automatically block all wireless MAC by
sending all the MACs into the block list of D-Link DSL-2640B.