Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢

Mohd Shahril shahril96

🐢
View GitHub Profile
@shahril96
shahril96 / A.py
Created May 12, 2018
eat.code.error.cry.repeat's (some) solutions for ACM ICPC Al-Khawarizmi 2018
View A.py
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
Twitter's tweet live counter (works as 4-may-2018)
View api.php
<?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 Apr 17, 2018
A simple script that uses .eval() function to evaluate an expression containing boolean values.
View boolean_evaluator.py
'''
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 Apr 6, 2018
A helper script to automatically setup a DOMjudge server in 10 minutes, go get yourself a coffee.
View domjudge-setup.sh
#!/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 Dec 12, 2017
FIFA'17 dataset analysis
View fifa17.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View notebook.ipynb
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 Nov 11, 2017
Systemd unit service for DOMJudge's judgehost
View judgehost.service
[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 Jul 12, 2017
Clone all gist from specified account (requires Requests)
View gist-clone-all.py
#!/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 Jul 2, 2017
Python script to fetch, parse and display RSS titles (intended to be used with reddit's netsec)
View rss.py
#!/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 Jun 26, 2017
Automatically block all wireless clients in the router (only for D-Link DSL-2640B)
View block-mac.py
'''
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.