Skip to content

Instantly share code, notes, and snippets.

View somidad's full-sized avatar

Seokseong Jeon somidad

View GitHub Profile
# http://stackoverflow.com/questions/8488758
function matlab_figure_without_focus(h)
set(0, 'CurrentFigure', h);
@somidad
somidad / google-scholar-to-rss.gs
Last active January 2, 2018 10:32
Google Scholar Alert (G)Mails to RSS feeds
var LABEL = '<your GMail label name storing Google Scholar Alert>'
var RECEIVER = '<your Blogger e-mail address>'
function get_quota() {
var quota = MailApp.getRemainingDailyQuota()
Logger.log(quota)
return quota
}
function myFunction() {
@somidad
somidad / gist:4089050d49230df1920a9001516fa241
Created January 2, 2018 12:38
Remove YouTube Red logo for 'Enhancer for YouTube'
var idLogoContainer = document.getElementById('logo-container')
var classLogoRed = idLogoContainer.getElementsByClassName('logo-red')
console.log(classLogoRed)
if (classLogoRed.length) {
var tag = classLogoRed[0]
console.log(tag)
tag.style.backgroundImage = 'none'
console.log(tag.style.background)
}
@somidad
somidad / decode_jwt.js
Created April 10, 2022 02:42
Decode JWT (without verification)
const [header, payload, signature] = jwt.split('.');
const buffer = Buffer.from(payload, 'base64');
const decoded = JSON.parse(buffer);
@somidad
somidad / workflow.yml
Last active January 15, 2025 08:43
GitHub Workflow to check any change on git repository and do something if any
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
- name: Check if there is any change
id: get_changes
# deprecated. see https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
#run: echo "::set-output name=changed::$(git status --porcelain | wc -l)"
run: echo "changed=$(git status --porcelain | wc -l)" >> $GITHUB_OUTPUT
- name: Do something if there is any change
if: steps.get_changes.outputs.changed != 0
run: do something
@somidad
somidad / logseq-publish-github-pages-wa.js
Last active June 25, 2022 07:54
Script to remove U+2029 from published Logseq graph for GitHub Pages
const { readFileSync, writeFileSync } = require("fs");
function indexOfUnicode(s, u) {
let i = -1;
for (i = 0; i < s.length; i++) {
if (s.charCodeAt(i) === u) {
break;
}
}
return i;
@somidad
somidad / publish-logseq.yml
Last active June 28, 2023 12:37
Deprecated. See logseq/publish-spa. GitHub workflow to publish a Logseq graph to GitHub Pages
name: Publish
on:
#push:
#branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
@somidad
somidad / read-file.jsx
Created June 7, 2023 14:20
Read a file on React
function Component() {
const onChange = (e) => {
const file = e.target.files?.[0];
if (!file) {
return;
}
const reader = new FileReader();
reader.addEventListener('load', () => {
console.log(reader.result);
});
@somidad
somidad / logseq-distinct-left-sidebar-nav-header.css
Created August 18, 2023 01:55
Logseq: Make nav header on left sidebar more distinct
/* Make nav header on left sidebar more distinct */
.left-sidebar-inner .nav-content-item .header {
background-color: var(--ls-tertiary-background-color);
}
@somidad
somidad / logseq-distinct-foreground-color.css
Last active September 20, 2023 15:01
Logseq: Make page ref, block ref, tag and marker look more distinct
/* Yello hyperlink on green background */
.page-ref {
color: #E0D772;
}
/* Yellow underline on green background */
.block-ref {
border-bottom-color: #E0D772;
}