Skip to content

Instantly share code, notes, and snippets.

@marc-queiroz
marc-queiroz / how-to-fix-tmux-fail.md
Created January 16, 2020 20:10 — forked from sv0/how-to-fix-tmux-fail.md
How to fix tmux error "terminal open failed: missing or unsuitable terminal: rxvt-unicode-256color"

If tmux fails with an error terminal open failed: missing or unsuitable terminal: rxvt-unicode-256color

log in to your remote host and create .terminfo/r in your home directory:

mkdir -p .terminfo/r

copy terminal information file to remote machine:

scp /usr/share/terminfo/r/rxvt-unicode* remote.host:.terminfo/r/

@marc-queiroz
marc-queiroz / make_certs.sh
Created November 18, 2019 17:19 — forked from mediaupstream/make_certs.sh
extract ca-certs, key, and crt from a pfx file
#!/bin/bash
#
# Usage:
# ./make_certs.sh test.example.com
#
# The required input to make_certs.sh is the path to your pfx file without the .pfx prefix
#
# test.example.com.key
# test.example.com.crt (includes ca-certs)
@marc-queiroz
marc-queiroz / system-sleep-xhci.sh
Created November 14, 2019 17:48 — forked from ioggstream/system-sleep-xhci.sh
Disable broken xhci device before suspend and avoid freeze.
#!/bin/sh
#
# This script should prevent the following suspend errors
# which freezes the Dell Inspiron laptop.
#
# Put it in /usr/lib/systemd/system-sleep/xhci.sh
#
# The PCI 00:14.0 device is the usb xhci controller.
#
# kernel: [67445.560610] pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -16
@marc-queiroz
marc-queiroz / rambox-css-style
Created October 16, 2019 19:52 — forked from orevial/rambox-css-style
Rambox : Add a custom CSS style to a service
function applycss(css){
var head = document.getElementsByTagName('head')[0];
var s = document.createElement('style');
s.setAttribute('type', 'text/css');
s.appendChild(document.createTextNode(css));
head.appendChild(s);
}
applycss('
// css from userstyles.org without the @-moz-document wrapper
@marc-queiroz
marc-queiroz / Client.cs
Created August 13, 2019 23:03
paulbatum/WebSocket-Samples - WebSocket-Samples/HttpListenerWebSocketEcho/Client/Client.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.WebSockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@marc-queiroz
marc-queiroz / base.html
Created August 7, 2019 13:27
Enable Vue browser devtools.
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script>
Vue.config.devtools = true
</script>
@marc-queiroz
marc-queiroz / util_tags.py
Last active August 7, 2019 14:35
Django - 2.X Tag to convert Query Object to JSON
from django import template
register = template.Library()
@register.filter(is_safe=False, name='json2')
def to_json2(data):
from django.http import JsonResponse
print('to_json: {}'.format(JsonResponse(list(data.values()), safe=False).content.decode('utf-8')))
return JsonResponse(list(data.values()), safe=False).content.decode('utf-8')
@marc-queiroz
marc-queiroz / Professor.sol
Created July 1, 2019 00:37
Professor Contract - Simple Example
pragma solidity ^0.4.19;
contract Professor {
string firstname;
string lastname;
uint collegeid;
address owner;
event ProfessorEv(
string firstname,
@marc-queiroz
marc-queiroz / fix.patch
Created June 7, 2018 18:52
Telegram patch
diff --git crypto/rsa_pem_openssl.c crypto/rsa_pem_openssl.c
index db653f2..5e6a697 100644
--- crypto/rsa_pem_openssl.c
+++ crypto/rsa_pem_openssl.c
@@ -36,6 +36,12 @@ TGLC_WRAPPER_ASSOC(rsa,RSA)
// TODO: Refactor crucial struct-identity into its own header.
TGLC_WRAPPER_ASSOC(bn,BIGNUM)
+/*
+ * Since OpenSSL version 1.1.0 the RSA struct (rsa_st) is opaque,
@marc-queiroz
marc-queiroz / test.cs
Created May 23, 2018 18:44
A C# code to generate toString from ProofUser, used on Proof of Reserves
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System;
using System.Security.Cryptography;
using System.Text;
using System.IO;
namespace Rextester