Skip to content

Instantly share code, notes, and snippets.

@Meorawr
Meorawr / async.lua
Last active December 12, 2023 05:13
Lua 5.1 Async/Await
#!/usr/bin/lua5.1
--- Async/Await for Lua 5.1
-- This script implements async/await functions for Lua, allowing tasks to
-- be queued and scheduled independently.
--
-- This is just an example and has a bunch of issues, isn't tested, isn't
-- even actually used anywhere; I basically just got bored and had one of
-- those "what if?" type ideas 6 hours ago.
local co_create = coroutine.create
// Note that this is not the production code
pragma solidity 0.5.6;
import "./IERC20.sol";
contract Wallet {
address internal token = 0x123...<hot_wallet_addr>;
address internal hotWallet = 0x321...<hot_wallet_addr>;
constructor() public {
@chrisswanda
chrisswanda / WireGuard_Setup.txt
Last active July 23, 2024 19:20
Stupid simple setting up WireGuard - Server and multiple peers
Install WireGuard via whatever package manager you use. For me, I use apt.
$ sudo add-apt-repository ppa:wireguard/wireguard
$ sudo apt-get update
$ sudo apt-get install wireguard
MacOS
$ brew install wireguard-tools
Generate key your key pairs. The key pairs are just that, key pairs. They can be
@rootkea
rootkea / spectre.c
Created January 4, 2018 15:36
PoC from Spectre Attacks: Exploiting Speculative Execution (https://spectreattack.com/spectre.pdf)
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@pexcn
pexcn / ChinaDNS Flow.md
Last active February 6, 2023 03:03
记录一下 ChinaDNS 的工作原理和一些 DNS 相关的想法

ChinaDNS 的工作流程

ChinaDNS 的上游 DNS 分为 国内 DNS可信 DNS

工作流程

  1. ChinaDNS 会同时向上游的 DNS 发送请求。
  2. 如果 可信 DNS 先返回,则直接采用 可信 DNS 的结果。
  3. 如果 国内 DNS 先返回,分两种情况:如果返回的结果是国内的 IP, 则采用;否则丢弃并转而采用 可信 DNS 的结果。
@clivetyphon
clivetyphon / easy-client-vpn-strongswan.md
Last active March 23, 2023 09:09
Easy client VPN for all major platforms using strongSwan IPsec

Easy client VPN for all major platforms using strongSwan IPsec

Overview

The goal here is to provide quick and easy but secure client VPN that can be configured natively without any additional software on:

  • Linux
  • iOS
  • Android
  • Windows
  • OSX
@Chion82
Chion82 / client.c
Created February 12, 2017 14:56
fake TCP test
#include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <string.h>
#include "trans_packet.h"
void on_packet_recv(char* from_ip, uint16_t from_port, char* payload, int size, unsigned int seq) {
printf("Packet received from=%s:%d, seq=%d\n", from_ip, from_port, seq);
char* message = (char*)malloc(size);
memcpy(message, payload, size);

This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window