Skip to content

Instantly share code, notes, and snippets.

View loslch's full-sized avatar

ChangHun Lee loslch

View GitHub Profile
@loslch
loslch / enableContextMenu.js
Created November 7, 2020 14:21
Bookmarklet :: Enable right click
javascript: function enableContextMenu(aggressive = false) { void(document.ondragstart=null); void(document.onselectstart=null); void(document.onclick=null); void(document.onmousedown=null); void(document.onmouseup=null); void(document.body.oncontextmenu=null); enableRightClickLight(document); if (aggressive) { enableRightClick(document); removeContextMenuOnAll("body"); removeContextMenuOnAll("img"); removeContextMenuOnAll("td"); } } function removeContextMenuOnAll(tagName) { var elements = document.getElementsByTagName(tagName); for (var i = 0; i < elements.length; i++) { enableRightClick(elements[i]); } } function enableRightClickLight(el) { el || (el = document); el.addEventListener("contextmenu", bringBackDefault, true); } function enableRightClick(el) { el || (el = document); el.addEventListener("contextmenu", bringBackDefault, true); el.addEventListener("dragstart", bringBackDefault, true); el.addEventListener("selectstart", bringBackDefault, true); el.addEventListener("click", bringBackDefault, true);
@loslch
loslch / crawl.py
Created March 10, 2020 23:21
Naver Cafe Article Crawler
#-*- coding:utf-8 -*-
import json
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.common.exceptions import NoSuchElementException
def find_element_by_css_selector(driver, css_selector):
try:
return driver.find_element_by_css_selector(css_selector)
@loslch
loslch / jenkins.sh
Created September 5, 2018 01:43
Allow to create user with special chars by editing /etc/init.d/jenkins
JAVA_ARGS="-Dhudson.security.HudsonPrivateSecurityRealm.ID_REGEX=\"^[\\w\\._-]+$\""
@loslch
loslch / main.c
Created August 13, 2018 14:11
A cheat sheet or reference card of basic algorithm in C
#include <stdlib.h>
#include <string.h>
static void swap(int *a, int *b) {
if (a != b) {
int c = *a;
*a = *b;
*b = c;
}
}
@loslch
loslch / static_assert.h
Created July 10, 2018 06:22
Static Assert in C
#define STATIC_ASSERT(e) \
typedef char __static_assert[(e) ? 1 : -1]
@loslch
loslch / macros.cpp
Last active July 10, 2018 04:18
C++ Macros
/* ref: https://apps.topcoder.com/forums/?module=Thread&threadID=670165&start=0 */
// Abbreviations for data types which occur most frequently in TopCoder problems:
typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
// There are two common versions of FOR macros:
@loslch
loslch / utility.md
Created June 14, 2018 07:09
Linux utilities
  • VLC – media player for videos
  • GIMP – Photoshop alternative for Linux
  • Pinta – Paint alternative in Linux
  • Calibre – eBook management tool
  • Chromium – Open Source web browser
  • Kazam – Screen recorder tool
  • Gdebi – Lightweight package installer for .deb packages
  • Spotify – For streaming music
  • Skype – For video messaging
  • Kdenlive – Video editor for Linux
@loslch
loslch / install.md
Created June 14, 2018 04:43
How to install NVIDIA drivers in Ubuntu

check current installed driver

$ cat /proc/driver/nvidia/version
lspci -k   # and see the `Kernel driver in use` field

update ppa of nvidia drivers

# ubuntu version >= 18.04
$ sudo add-apt-repository ppa:graphics-drivers/ppa
@loslch
loslch / import_certs.cmd
Last active May 31, 2018 06:16
Import "root" certificates on Windows
REM download authroot.stl from http://ctldl.windowsupdate.com/msdownload/update/v3/static/trustedr/en/authrootstl.cab
certutil -addstore -f root authroot.stl
@loslch
loslch / INSTALL.md
Created May 30, 2018 00:49 — forked from arya-oss/INSTALL.md
Ubuntu 16.04 Developer Tools installation

Ubuntu 16.04 Developer Tools Installation

First things first !

sudo apt update
sudo apt upgrade

Standard Developer Tools

sudo apt-get install build-essential git