Skip to content

Instantly share code, notes, and snippets.

@Ilgrim
Ilgrim / Mercurial.ini
Created Jun 24, 2020 — forked from nfreear/Mercurial.ini
Mercurial.ini / .hgrc - HG configuration file
View Mercurial.ini
# Mercurial configuration.
[http_proxy]
#host = wwwcache.open.ac.uk:80
[ui]
username = Nick Freear <ME@example.org>
# Editor - I'll use vi for now!
@Ilgrim
Ilgrim / README.md
Created Jun 19, 2020 — forked from Jxck/README.md
libuv TCP server/client sample
View README.md

how to compile

$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices server.c -o server
$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices client.c -o client
@Ilgrim
Ilgrim / asynchronous_example.py
Created May 11, 2020 — forked from iamtheburd/asynchronous_example.py
Example showing asynchronous HTTP request with Python 3.5.0 + asyncio
View asynchronous_example.py
import requests
import asyncio
from concurrent.futures import ThreadPoolExecutor
from timeit import default_timer
START_TIME = default_timer()
def fetch(session, csv):
base_url = "https://people.sc.fsu.edu/~jburkardt/data/csv/"
with session.get(base_url + csv) as response:
@Ilgrim
Ilgrim / proxy_server.py
Created May 10, 2020 — forked from oeway/proxy_server.py
Proxy Server with aiohttp
View proxy_server.py
import logging
import sys
from urllib.parse import urljoin
import asyncio
import aiohttp
from aiohttp import web
TARGET_SERVER_BASE_URL = 'http://127.0.0.1:8888'
@Ilgrim
Ilgrim / proxy_server.py
Last active May 10, 2020 — forked from barrachri/proxy_server.py
Proxy Server with aiohttp
View proxy_server.py
import logging
import sys
from urllib.parse import urljoin
import asyncio
import aiohttp
from aiohttp import web
TARGET_SERVER_BASE_URL = 'http://127.0.0.1:8888'
@Ilgrim
Ilgrim / ddnsserver.py
Created May 8, 2020 — forked from pklaus/ddnsserver.py
Simple DNS server (UDP and TCP) in Python using dnslib.py
View ddnsserver.py
#!/usr/bin/env python
# coding=utf-8
import argparse
import datetime
import sys
import time
import threading
import traceback
import socketserver
@Ilgrim
Ilgrim / qemu_vm_mount_windows_local_folder.sh
Created May 7, 2020 — forked from neelabhg/qemu_vm_mount_windows_local_folder.sh
Mount a Windows host's folder on a QEMU Linux guest
View qemu_vm_mount_windows_local_folder.sh
#! /bin/bash
# The Windows folder needs to be shared appropriately
WINDOWS_DIR_PATH="//10.0.2.2/workdir"
MNTPOINT="/workdir_local"
if [ ! -d "$MNTPOINT" ]; then
mkdir $MNTPOINT
fi
View usbip_barebones_demo.py
#!/usr/bin/env python3
from collections import namedtuple
import socket
import struct
usbip_user_op_common = namedtuple('usbip_user_op_common', 'version code status')
usbip_usb_device = namedtuple('usbip_usb_device', 'path busid busnum devnum speed idVendor idProduct bcdDevice bDeviceClass bDeviceSubClass bDeviceProtocol bConfigurationValue bNumConfigurations bNumInterfaces')
usbip_header_basic = namedtuple('usbip_header_basic', 'command seqnum devid direction ep')
@Ilgrim
Ilgrim / AddToCartFormWithHooks.tsx
Created Apr 8, 2020 — forked from jedmao/AddToCartFormWithHooks.tsx
React Hooks and Render Props in TypeScript
View AddToCartFormWithHooks.tsx
import { FC, useCallback } from 'react'
import { connect } from 'react-redux';
import addToCart from '../actions/cart'
import useAddToCart, { UseAddToCartOptions } from './useAddToCart'
interface DispatchProps {
onSubmit(options: UseAddToCartOptions): Promise<void>,
}
@Ilgrim
Ilgrim / server.js
Created Mar 23, 2020 — forked from bitnetwork/server.js
A telnet server written in Node.js
View server.js
var lib_net = require("net");
var lib_chalk = require("chalk");
var clients = {};
var lastId = -1;
function cleanInput(data) {
return data.toString().replace(/(\r\n|\n|\r)/gm,"");
}
You can’t perform that action at this time.