Skip to content

Instantly share code, notes, and snippets.

View ngbeslhang's full-sized avatar

ngb ngbeslhang

View GitHub Profile
@ngbeslhang
ngbeslhang / custom-material.css
Last active January 10, 2017 14:32
Sightly modified custom Discord CSS based on https://github.com/AlexFlipnote/Discord_MaterialTheme/
@import "https://rawgit.com/AlexFlipnote/Discord_MaterialTheme/master/theme.css";
/* For Discord_MaterialTheme, replace the default red no-border indicator to white black border circle. */
.guilds-wrapper .guilds .guild.selected.unread:before,
.guilds-wrapper .guilds .guild.selected:before,
.guilds-wrapper .guilds .guild.unread:before {
background: #eaeaea;
box-shadow: 0px 1px 0 rgba(0, 0, 0, 0.3), inset 0 1px 0 hsla(0, 0%, 100%, .15);
border: 1px solid #212121;
height: 11px;
@ngbeslhang
ngbeslhang / quak.txt
Last active March 28, 2017 22:09
Ctrl + F to search for Pokemon's name and corresponding key | Don't ask me why it's off center
TIP: If you want to find the exact Pokedex number, surround one space between the number in Ctrl+F, e.g. " 1 " gives you exactly 1 result.
------------------------------------------------------------
| | | |
| Key | Name | Region |
| | | |
|----------------------------------------------------------|
| | | |
| 1 | Bulbasaur | Kanto |
| | | |
@ngbeslhang
ngbeslhang / download.py
Created April 15, 2017 15:41
Automatically download songs from links in a txt file because mom pls
import youtube_dl
ydl = youtube_dl.YoutubeDL({
'format': 'bestvideo+bestaudio',
"nocheckcertificate": True,
"keepvideo": True
})
with open("songs.txt", 'r') as q:
ydl.download(q.readlines())
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@ngbeslhang
ngbeslhang / dot_dict.py
Created July 29, 2017 14:30 — forked from floer32/dot_dict.py
DotDict is a variation of the classic "Bunch" recipe - just a dictionary, with all the normal dictionary methods, but the attributes are accessible by dot notation. Use this when you just really want to turn some dictionaries (i.e. from JSON) into something like JavaScript objects. Achieved with very little code. See bottom of docstring for Stac…
class DotDict(dict):
""" A dictionary whose attributes are accessible by dot notation.
This is a variation on the classic `Bunch` recipe (which is more limited
and doesn't give you all of dict's methods). It is just like a dictionary,
but its attributes are accessible by dot notation in addition to regular
`dict['attribute']` notation. It also has all of dict's methods.
.. doctest::
@ngbeslhang
ngbeslhang / README.md
Created August 13, 2018 06:43
Malaysian Phone Number Regex
### Keybase proof
I hereby claim:
* I am ngbeslhang on github.
* I am ngbeslhang (https://keybase.io/ngbeslhang) on keybase.
* I have a public key ASBevUCC8AlHQ3u-T8B_vVJTlb-Q3UYVtRoLnuFo5cV4TQo
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am ngbeslhang on github.
  • I am ngbeslhang (https://keybase.io/ngbeslhang) on keybase.
  • I have a public key ASCmWDSopYy_a-jGhsdkc2kJuKoJpEz5xFGI8NCA93i2DQo

To claim this, I am signing this object:

@ngbeslhang
ngbeslhang / playlist_creator.py
Last active May 20, 2021 22:44
Python 3 script that converts Youtube playlists through youtube-dl into format-agnostic VLC-compatible .m3u8 playlist file in the order of the source playlist
# MADE AND TESTED ONLY FOR YOUTUBE PLAYLISTS
# Requires youtube-dl option `--write-info-json` to work
# For this to work, you need to put this script into the directory (folder) of the videos and JSON files
import os
import json
# Separate JSON metadata files and media files
for path, dirname, filenames in os.walk(os.getcwd()):
json_filenames = [name for name in filenames if name.endswith('.info.json')]
media_filenames = [name for name in filenames if not name.endswith('.info.json')]
@ngbeslhang
ngbeslhang / request_time.py
Last active July 8, 2022 23:12 — forked from andrewwatts/request_time.py
urllib2 vs urllib3 vs requests; updated for Python 3
#!/usr/bin/env python3
import time
# REMEMBER TO CHANGE THE VARIABLES BELOW BEFORE YOU RUN THE SCRIPT
_URL = 'http://localhost/tmp/derp.html'
_NUMBER = 1000
def test_urllib2():