Skip to content

Instantly share code, notes, and snippets.

View pankeshang's full-sized avatar

Pan Keshang pankeshang

View GitHub Profile
@pankeshang
pankeshang / gitlab.js
Last active May 19, 2021 10:27
enlarge Gitlab content window
var elements;
elements = document.getElementsByClassName("container-fluid container-limited limit-container-width")
for (i = 0; i< elements.length; i++) {
var x = elements[i];
x.setAttribute("style", "max-width:100%");
}
elements = document.getElementsByClassName("container-limited limit-container-width")
for (i = 0; i< elements.length; i++) {
var x = elements[i];
@pankeshang
pankeshang / gist:133b95480d55325c347489fb0d11c4c1
Created January 4, 2019 10:35
Delete Slack files from Chrome console
/*
Open "files" from top right button, then open chrome console and paste the code below
it will try to delete 18 files in a row, asking for your permission every time
*/
for (i=1; i< 19; i++) {
var a = document.querySelector('#files_tab > div > div.p-file_list > div:nth-child(1) > div > div.c-virtual_list.c-virtual_list--scrollbar.c-scrollbar > div.c-scrollbar__hider > div > div > div:nth-child(' + i + ') > div > div.c-file__actions > span> button')
a.click()
"""
note while mapping https://myinfo-api.app.gov.sg/dev/tutorial3 from node into python
"""
import os
import base64
from cryptography import exceptions
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization, hashes
from cryptography.hazmat.primitives.asymmetric import padding
@pankeshang
pankeshang / rename_files_on_s3.py
Created April 9, 2018 01:45
List files in a S3 bucket, then go through them, rename files when necessary
import boto3
access_key = '123'
secret_key = '234'
bucket_name = 'bucket'
client =boto3.client(
's3',
aws_access_key_id=access_key,
aws_secret_access_key=secret_key,
)
@pankeshang
pankeshang / trello-wider.js
Last active February 14, 2018 02:25
Change Trello card to a wider layout
const WIDTH = '400px';
const HEIGHT = '100px';
var lists = document.getElementsByClassName('list-wrapper');
var kslist, card;
for( i=0; i < lists.length; i++) {
kslist = lists[i];
kslist.setAttribute('style', 'width: ' + WIDTH);
var cards = kslist.getElementsByClassName('list-card');
@pankeshang
pankeshang / dm5.js
Last active August 9, 2019 06:51
removed dm5 ads because they are blocking the view
var a = document.getElementsByClassName('yddiv');
for(i=0; i<9; i++){
a[i].setAttribute('style', 'height:0');
}
document.getElementById('xuanfu_news_id').setAttribute('style', 'height:0');
@pankeshang
pankeshang / youtube-min-size-winsow.js
Last active September 21, 2018 08:44
get a min-size youtube window on ubuntu
// use developer console, paster these code and run, you will have a small new window which is minimized
// and ready to be put to "always on top"
(function() {
var href=document.location.href;
var newWindow = window.open(href, "myWindowName", "resizable");
newWindow.resizeTo(445,255); //resize window to 445x255
newWindow.onload = function () {
var newDocument = newWindow.document;
try {
var content = newDocument.getElementById('content');
@pankeshang
pankeshang / .bashrc
Created July 26, 2017 05:38
additional configuration for my ubuntu 16.04 .bashrc
# activate virtualenvwrapper
export WORKON_HOME=~/Envs
mkdir -p $WORKON_HOME
source /usr/local/bin/virtualenvwrapper.sh
# git promt
# source: https://coderwall.com/p/fasnya/add-git-branch-name-to-bash-prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'