Skip to content

Instantly share code, notes, and snippets.

@tommie
tommie / gist:89011c5ac06553d5cdb8
Last active December 6, 2023 06:08
PL2303 USB Protocol

A description of the PL2303HX USB protocol.

Control Transfers

Read Register

Read a device register value.

  • bmRequestType: IN, VENDOR, DEVICE
  • bRequest: 1
  • wValue: 80h | registerNumber
@st4lk
st4lk / vkcom_audio_download.py
Last active October 24, 2023 13:13
Python: vkontakte.ru (vk.com) audio music downloader
# -*- coding: utf-8 -*-
"""
Скрипт для скачивания музыки с сайта vkontakte.ru (vk.com)
Запуск:
python vkcom_audio_download.py
Принцип работы:
Скрипт проверяет сохраненный access_token. Если его нет или срок истек,
то открывается страница в браузере с запросом на доступ к аккаунту.

About this guide

This is a brief introduction to Lojban, a constructed human language. It has a very nice, fun, regular grammar that computers and humans alike can understand easily.

Basic grammar

All Lojban words are either particles (tiny words that help the grammar) or verbs (which tell us how nouns relate).

A Lojban sentence consists of a main verb with a bunch of nouns plugged into it.

A Lojban verb definition looks like this:

@jdx
jdx / boot.js
Last active March 16, 2023 18:08
zero-downtime node.js app runner
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
@ryancdotorg
ryancdotorg / rsabd.py
Last active March 13, 2023 15:57
backdoored rsa key generation
#!/usr/bin/env python
import sys
import gmpy
import curve25519
from struct import pack
from hashlib import sha256
from binascii import hexlify, unhexlify
@Amice13
Amice13 / drv_curl_examples.sh
Last active February 3, 2023 23:26
Запросы в CURL для данных Реестра избирателей
# Человекочитаемое описание результатов запроса здесь: https://www.drv.gov.ua/ords/portal/!cm_core.cm_index?option=ext_static_page&ppg_id=262&pmn_id=161
# Получение данных про органы распорядителей и ведения Реестра избирателей
curl --header "Content-Type: text/xml;charset=UTF-8" --data "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:drv=\"http://www.drv.gov.ua/\"><soap:Header/><soap:Body><drv:GetOrgansService /></soap:Body></soap:Envelope>" https://www.drv.gov.ua/ords/svc/personal/API/Opendata
# Получение данных про избирательные округи
curl --header "Content-Type: text/xml;charset=UTF-8" --data "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:drv=\"http://www.drv.gov.ua/\"><soap:Header/><soap:Body><drv:GetAreas /></soap:Body></soap:Envelope>" https://www.drv.gov.ua/ords/svc/personal/API/Opendata
# Получение данных про избирательные участки. Необходимо менять параметр Area (получаются из сервиса GetAreas)
curl --header "Content-Type: text/xml;charse
@lpereira
lpereira / gist:c0bf3ca3148321395037
Created June 23, 2014 22:26
Integer to string conversion benchmark
#include <chrono>
#include <cstdint>
#include <iostream>
#include <random>
#include <sstream>
using namespace std;
using namespace std::chrono;
const uint64_t P01 = 10;
@kikairoya
kikairoya / seh.cc
Last active December 10, 2022 15:19
SEH for gcc
/*
Copyright (c) 2012- kikairoya
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
@nhatminhle
nhatminhle / stdatomic.h
Last active November 23, 2022 10:15
A portable version of stdatomic.h extracted from the FreeBSD libc, for Clang 3.1+ and GCC 4.7+.
/*
* An implementation of C11 stdatomic.h directly borrowed from FreeBSD
* (original copyright follows), with minor modifications for
* portability to other systems. Works for recent Clang (that
* implement the feature c_atomic) and GCC 4.7+; includes
* compatibility for GCC below 4.7 but I wouldn't recommend it.
*
* Caveats and limitations:
* - Only the ``_Atomic parentheses'' notation is implemented, while
* the ``_Atomic space'' one is not.
@kares
kares / gammusms2android.rb
Created March 8, 2012 06:58
Gammu to Android SMS converter. Assumes your backup has been exported as XML.
#!/usr/bin/evn ruby
# (Not just) Nokia 2 Android SMS converter script.
#
# This tool assumes you've backed up your SMS messages from your device using
# Gammu (Wammu) http://wammu.eu/wammu/ in XML format e.g.
#
# * open Wammu and connect your phone: Phone -> Connect
# * retrieve messages (or all) using: Retrieve -> Messages
# * backup as XML using: Backups -> Export messages to XML