Skip to content

Instantly share code, notes, and snippets.

@tiagorangel2011
tiagorangel2011 / jwt-decoder.js
Last active April 23, 2024 17:58
JWT decoder used for Authflow
// 💡 Tip: need to decode with node.js? Use the @authflow-js/verify npm module
function decryptJWT(e) {
function b64(e) {
return decodeURIComponent(Array.prototype.map.call(atob(e), function (e) {
return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2)
}).join(""))
}
try {
const r = e
@mesuutt
mesuutt / format-money-try.js
Last active April 23, 2024 17:57
Format money as Turkish money format.
function formatMoney(n) {
return parseFloat(n).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1.').replace(/\.(\d+)$/,',$1');
}
formatMoney(1234567) // 1.234.567,00
formatMoney(1234567.99) // 1.234.567,99
@milindjagre
milindjagre / WordToPdf.java
Created April 13, 2016 11:57
This java file will convert word file into pdf file. Word to Pdf converter using JAVA API.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.milind.word.to.pdf;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
@allanger
allanger / Deploy_Kubernetes.md
Last active April 23, 2024 17:56
Deploy Kubernetes with Ansible

Deploy Kubernetes with Ansible

Requirements

We will need at least two nodes, Ansible, and a kubectl. That's enough to begin.

My ansible role: https://github.com/allanger/kubeadm-ansible-role

I am using Ubuntu 21.04 on all my servers so my Ansible role is written for Debian-based distros. (I will be happy if anybody adds support for other distros)

Preparing system

@Vendicated
Vendicated / ids.txt
Last active April 23, 2024 17:56
spy pet account ids, gathered by @Dziurwa14. be careful, their api now returns innocent people. don't get tricked into banning the wrong people. do not trust their api and double check before banning
1210165420493905982
956054319529066527
956075132571508757
1171196139647803513
956210819325132921
956164930061619230
1185038257789079614
956246550152118374
956178931512410222
1172076548791226439
@karpathy
karpathy / min-char-rnn.py
Last active April 23, 2024 17:55
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@Joao-Peterson
Joao-Peterson / gmk67_linux.md
Last active April 23, 2024 17:55
Using GMK67 keyboard in linux. Function keys not working with Fn!

GMK67 with Linux!

Recently i bought a zuoya gmk67 keyboard, it doesn't have a function keys row and has a know for volume control. Unfortunately, if you plug your gmk67 in a linux machine you will notice that using fn+1 will not produce f1 as expected, it will produce a screen brightness decrease, and if you change the physical switch in the back for the macOS mode, the function keys now work, but the modifier keys don't, quite stressful.

Fear not, you can either alter your system configuration so the keyboard functions normally, as in this gist, or remap the keys, as seen in the gist Using GMK67 keyboard in linux with key remaps!.

For this gist we are going to alter the configuration for the apple hid driver on linux, since this keyboard uses it, and alter the functionality of the Fn key.

This is tested on archlinux, for any other distro you might have to figure out yourself the correponding commands!

@diego3g
diego3g / settings.json
Last active April 23, 2024 17:55
VSCode Settings (Updated)
{
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 14,
"editor.lineHeight": 1.8,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.rulers": [80, 120],
"extensions.ignoreRecommendations": true,
"typescript.tsserver.log": "off",
"files.associations": {
@ziadoz
ziadoz / halt_compiler.php
Last active April 23, 2024 17:55
Using PHP Halt Compiler
<?php
/**
* The __halt_compiler() function will stop the PHP compiler when called.
* You can then use the __COMPILER_HALT_OFFSET__ constant to grab the contents of the PHP file after the halt.
* In this example a PHP template is stored after the halt, to allow simple separation of logic from templating.
* The template is stored in a temporary file so it can be included and parsed.
*
* See: https://github.com/bobthecow/mustache.php/blob/dev/src/Mustache/Loader/InlineLoader.php
* http://php.net/manual/en/function.halt-compiler.php
*/
@imba-tjd
imba-tjd / .Cloud.md
Last active April 23, 2024 17:55
☁️ 一些免费的云资源

IaaS指提供系统(可以自己选)或者储存空间之类的硬件,软件要自己手动装;PaaS提供语言环境和框架(可以自己选);SaaS只能使用开发好的软件(卖软件本身);BaaS一般类似于非关系数据库,但各家不通用,有时还有一些其它东西。

其他人的集合