Skip to content

Instantly share code, notes, and snippets.

View QGB's full-sized avatar
💭
unhappy=

Too large to fit in the margin QGB

💭
unhappy=
  • Please
  • Follow me
View GitHub Profile
No. Time Source Destination Protocol Length Info
7 0.003263 127.0.0.1 127.0.0.1 AMQP 393 Connection.Start
Frame 7: 393 bytes on wire (3144 bits), 393 bytes captured (3144 bits)
Arrival Time: Jul 21, 2011 08:05:16.227656000 MSD
Epoch Time: 1311221116.227656000 seconds
[Time delta from previous captured frame: 0.000145000 seconds]
[Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 0.003263000 seconds]
Frame Number: 7
@pazdera
pazdera / prototype.py
Created August 3, 2011 10:45
Example of `prototype' design pattern in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Example of `prototype' design pattern
# Copyright (C) 2011 Radek Pazdera
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@tiye
tiye / default.custom.yaml
Created September 23, 2012 06:04
尝试了下 Rime 输入法
# Rime setting
patch:
"menu/page_size": 9
schema_list:
- schema: luna_pinyin
- schema: cangjie5
- schema: luna_pinyin_fluency
- schema: luna_pinyin_simp
- schema: double_pinyin_flypy
@jkstill
jkstill / proc_net_tcp_decode
Last active May 8, 2024 13:54
decode entries in /proc/net/tcp
Decoding the data in /proc/net/tcp:
Linux 5.x /proc/net/tcp
Linux 6.x /proc/PID/net/tcp
Given a socket:
$ ls -l /proc/24784/fd/11
lrwx------ 1 jkstill dba 64 Dec 4 16:22 /proc/24784/fd/11 -> socket:[15907701]
@tessus
tessus / compile_tmux.sh
Last active January 25, 2024 23:37
compile tmux (static)
#!/bin/bash
TMUX_VERSION=2.3
NCURSES_VERSION=6.0
LIBEVENT_VERSION=2.0.22
BASEDIR=${HOME}/work/tmux-static
TMUXTARGET=${BASEDIR}/local
mkdir -p $TMUXTARGET
cd $BASEDIR
@lars-tiede
lars-tiede / asyncio_loops.py
Last active April 3, 2024 15:28
asyncio + multithreading: one asyncio event loop per thread
import asyncio
import threading
import random
def thr(i):
# we need to create a new loop for the thread, and set it as the 'default'
# loop that will be returned by calls to asyncio.get_event_loop() from this
# thread.
loop = asyncio.new_event_loop()
@maartenbreddels
maartenbreddels / ipython_thread.py
Last active July 28, 2020 14:07
IPython snippet for doing work in a thread, and updating a progressbar
import threading
from IPython.display import display
import ipywidgets as widgets
import time
def get_ioloop():
import IPython, zmq
ipython = IPython.get_ipython()
if ipython and hasattr(ipython, 'kernel'):
return zmq.eventloop.ioloop.IOLoop.instance()
ioloop = get_ioloop()
@dwilkie
dwilkie / docker-cheat-sheat.md
Last active May 12, 2024 14:08
Docker Cheat Sheet

Build docker image

$ cd /path/to/Dockerfile
$ sudo docker build .

View running processes

@elehcim
elehcim / build.sh
Last active January 11, 2024 22:58
termux conda installation trial
apt update && apt upgrade
apt install python python-dev pip clang
pip install --upgrade pip
pip install conda
## All the following packages are needed by conda
pip install auxlib ruamel.yaml requests
## Install pycosat (this can be ignored if https://github.com/ContinuumIO/pycosat/pull/29 is fixed)
wget https://pypi.python.org/packages/76/0f/16edae7bc75b79376f2c260b7a459829785f08e463ecf74a8ccdef62dd4a/pycosat-0.6.1.tar.gz#md5=c1fc35b17865f5f992595ae0362f9f9f
tar -xf pycosat-0.6.1.tar.gz
@azureru
azureru / extract android kernel.md
Last active March 17, 2024 21:54
How to Extract Android Kernel And Modify The Boot Ramdisk (Android 4.4) on Allwinner based Processor

Extracting Existing Kernel + Ramfs

Enter the machine using adb shell

Run cat /proc/partitions

  #  Path                     Purpose        Size
  0 /dev/block/mmcblk0                       7761920
  1 /dev/block/mmcblk0p1      data           6085631