Skip to content

Instantly share code, notes, and snippets.

@srikiranvelpuri
srikiranvelpuri / refreshOAuthToken.js
Last active May 14, 2024 11:13
Postman PreRequestScript to check if an OAuth token has expired and, if so, refreshes it by making a new authentication request.
const expiryDate = new Date(pm.environment.get('tokenExpiryDate'));
const currDate = new Date(Date.now());
const isTokenExpired = (isNaN(expiryDate) || expiryDate) < currDate;
if(isTokenExpired){
pm.sendRequest({
url: pm.globals.get("oAuthUrl"),
method: 'POST',
header: {
'Authorization': pm.globals.get("basicAuth"),
@v1mkss
v1mkss / JetBrains Activation.md
Last active May 14, 2024 11:13
JetBrains Activation

JetBrains Activation

  • No proxy for:
*.apache.org, *.github.com, *.github.io, *.githubusercontent.com, *.gitlab.com, *.google.com, *.gradle.org, *.jetbrains.space, *.maven.org, cache-redirector.jetbrains.com, cloudconfig.jetbrains.com, download-cdn.jetbrains.com, download.jetbrains.com, downloads.marketplace.jetbrains.com, ea-report.jetbrains.com, github.com, gitlab.com, google.com, gradle.org, jcenter.bintray.com, plugins.jetbrains.com, resources.jetbrains.com, www.jetbrains.com

Activation Key:

UX394X3HLT-eyJsaWNlbnNlSWQiOiJVWDM5NFgzSExUIiwibGljZW5zZWVOYW1lIjoiSG9uZ2lrIFVuaXZlcnNpdHntmY3snbXrjIDtlZnqtZAiLCJsaWNlbnNlZVR5cGUiOiJDTEFTU1JPT00iLCJhc3NpZ25lZU5hbWUiOiLkvJfliJvkupEg5bel5L2c5a6kIiwiYXNzaWduZWVFbWFpbCI6ImhhbmF6YXdhbWl0b0BnbWFpbC5jb20iLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiJGb3IgZWR1Y2F0aW9uYWwgdXNlIG9ubHkiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IkdPIiwicGFpZFVwVG8iOiIyMDI0LTEyLTEzIiwiZXh0ZW5kZ
@dukejones
dukejones / mydomain.com.conf
Created October 1, 2023 05:12
SvelteKit Nginx config -- nodejs adapter
upstream sveltekit-server {
server 127.0.0.1:3000;
keepalive 8;
}
server {
listen 80;
server_name mydomain.com;
root /home/deploy/frontend/build/client;
@xirixiz
xirixiz / Set up GitHub push with SSH keys.md
Last active May 14, 2024 11:10 — forked from developius/README.md
Set up GitHub push with SSH keys

SSH keypair setup for GitHub (or GitHub/GitLab/BitBucket, etc, etc)

Create a repo.

Make sure there is at least one file in it (even just the README.md)

Generate a SSH key pair (private/public):

ssh-keygen -t rsa -C "your_email@example.com"
@vratiu
vratiu / .bash_aliases
Last active May 14, 2024 11:12
Git shell coloring
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
ac_add_options --enable-artifact-builds
# ac_add_options --with-ccache=/usr/local/bin/ccache
ac_add_options --enable-debug-js-modules
# ac_add_options --enable-debug
# ac_add_options --with-branding=browser/branding/official
# ac_add_options --with-branding=browser/branding/aurora
# ac_add_options --enable-official-branding
@Longhanks
Longhanks / .config chromium-flags.conf
Last active May 14, 2024 11:09
chromium --enable-gpu-rasterization --enable-zero-copy --enable-accelerated-video-decode
--enable-accelerated-video-decode
--enable-accelerated-mjpeg-decode
--enable-features=VaapiVideoDecoder,CanvasOopRasterization
--enable-gpu-compositing
--enable-gpu-rasterization
--enable-native-gpu-memory-buffers
--enable-oop-rasterization
--canvas-oop-rasterization
--enable-raw-draw
--use-vulkan
@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except:
@ole1986
ole1986 / traffic-control.sh
Last active May 14, 2024 11:08
Traffic control script for incoming and outgoing packages using TC (on a specific ip address)
#!/bin/bash
VERSION="1.0.2"
# Interface connect to out lan
INTERFACE="eth0"
# Interface virtual for incomming traffic
VIRTUAL="ifb0"
# set the direction (1 = outgoing only, 2 = incoming only 3 = both)
DIRECTION=3
# Speed
@juliandescottes
juliandescottes / remote_documentation_review.txt
Created January 31, 2019 17:11
Review of existing documentation for remote debugging on MDN
New about:debugging aims to sunset:
- old about:debugging
- WebIDE
- Connect... page
Most documentation pages for those applications screens will have to be updated/modified to describe the experience using the new about:debugging. For WebIDE:
- some features are not going to be in the MVP of the new about:debugging
- some features will not be ported
- some features have already been dropped from WebIDE but are still documented (eg, everything about developping apps or debugging Firefox OS)