Skip to content

Instantly share code, notes, and snippets.

@ryerh
ryerh / tmux-cheatsheet.markdown
Last active July 5, 2024 08:16 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件��理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@jesster2k10
jesster2k10 / README.md
Last active July 5, 2024 08:16
JWT Auth + Refresh Tokens in Rails

JWT Auth + Refresh Tokens in Rails

This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.

I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)

Before trying it out DIY, I considered using:

@savelee
savelee / index.html
Created December 6, 2019 17:20
A best practice for streaming audio from a browser microphone to Dialogflow or Google Cloud STT by using websockets.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>RecordRTC over Socket.io</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="https://www.WebRTC-Experiment.com/RecordRTC.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script>
@zhuziyi1989
zhuziyi1989 / URL Schemes.md
Last active July 5, 2024 08:13
常用 URL Schemes 收集。

** 由于此文年事已久,可能某些URL Schemes已失效,可在评论区留言指出!(最后更新于 2024.4.16)

关于 URL Scheme 你知道多少?

iOS系统中

由于苹果的各应用都是在沙盒中,不能够互相之间访问或共享数据。但是苹果还是给出了一个可以在APP之间跳转的方法:URL Scheme。简单的说,URL Scheme就是一个可以让 APP 相互之间可以跳转的协议。每个 APP 的URL Scheme都是不一样的,如果存在一样的URL Scheme,那么系统就会响应先安装那个 APP 的URL Scheme,因为后安装的 APP 的URL Scheme被覆盖掉了,是不能被调用的。

Android系统中

@dutc
dutc / kwargh.py
Created September 1, 2015 16:04
help(f) # KWARGHHH!!!
#!/usr/bin/env python3
from ast import parse
from ast import AST, FunctionDef, Lambda, Call
from collections import Iterable
# some notes
# kwargh:
# when you're using matplotlib or pandas
# and you do help(func) to figure out what
@Serganbus
Serganbus / шпаргалка по psql.txt
Last active July 5, 2024 08:12
шпаргалка по psql
Полезные ключи программы psql
-U - Указываем пользователя, например postgres
-W - Приглашение на ввод пароля
-d название_БД - Подключение к БД название_БД
-h имя_хоста - Подключение к хосту имя_хоста
-p порт - По какому порту постгря ожидает подключения
-c команда - Выполнение команды SQL без выхода в интерактивный режим
-f file.sql - Выполнение команд из файла file.sql
-S - Однострочный режим, то есть, переход на новую строку будет выполнять запрос (избавляет от ; в конце конструкции SQL)
@ixahmedxi
ixahmedxi / settings.json
Created January 2, 2024 20:45
VSCode settings.json
{
// open json editor for settings
"workbench.settings.editor": "json",
// Theme
"workbench.colorTheme": "Aura Dark",
"workbench.iconTheme": "moxer-icons",
// Change font
"editor.fontFamily": "Geist Mono",
@oborichkin
oborichkin / tls_client.py
Last active July 5, 2024 08:06
Simple TLS client and server on python
import socket
import ssl
from tls_server import HOST as SERVER_HOST
from tls_server import PORT as SERVER_PORT
HOST = "127.0.0.1"
PORT = 60002
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
// start with:
// frida -U -l pinning.js -f [APP_ID] --no-pause
Java.perform(function () {
console.log('')
console.log('===')
console.log('* Injecting hooks into common certificate pinning methods *')
console.log('===')
var X509TrustManager = Java.use('javax.net.ssl.X509TrustManager');
@apolopena
apolopena / JSConvert12to24Time.js
Last active July 5, 2024 08:05
JavaScript: convert 12 hours time string to 24 hour time string
// NOTE: time string must look like this 07:05:45PM or this 07:05:45AM and account for 12:00:00AM and convert 12:00:00pm to 12:00:00
function timeConversion(s) {
const ampm = s.slice(-2);
const hours = Number(s.slice(0, 2));
let time = s.slice(0, -2);
if (ampm === 'AM') {
if (hours === 12) { // 12am edge-case
return time.replace(s.slice(0, 2), '00');
}
return time;