This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [header, payload, signature] = jwt.split('.'); | |
const buffer = Buffer.from(payload, 'base64'); | |
const decoded = JSON.parse(buffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/8488758 | |
function matlab_figure_without_focus(h) | |
set(0, 'CurrentFigure', h); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This git alias allows you to move | |
# to the root of a local git repository | |
# (if you are in the repo) | |
# define a shortcut to git root | |
git config --global alias.root 'rev-parse --show-toplevel' | |
# Usage: go to the git root | |
cd $(git root) | |
# Usage: add all under the git root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE busconfig PUBLIC | |
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | |
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | |
<busconfig> | |
<policy user="root"> | |
<allow own="org.freedesktop.NetworkManager"/> | |
<allow send_destination="org.freedesktop.NetworkManager"/> | |
<allow send_interface="org.freedesktop.NetworkManager"/> | |
<allow own="org.freedesktop.NetworkManager.PPP"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim:syntax=apparmor | |
# Last Modified: Fri Jul 17 11:46:19 2009 | |
# Author: Jamie Strandboge <jamie@canonical.com> | |
#include <tunables/global> | |
/sbin/dhclient { | |
#include <abstractions/base> | |
#include <abstractions/nameservice> | |
capability net_bind_service, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import urllib.parse as parse | |
import os | |
def print_usage(): | |
print('Usage: decodeurl.py encodedfilename') | |
def main(fname): | |
if not os.path.isabs(fname): |