This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Python script to make Skype co-operate with GNOME3 notifications. | |
# | |
# Copyright (c) 2012, Mike Kazantsev | |
# Copyright (c) 2011, John Stowers | |
# Copyright (c) 2009, Lightbreeze | |
# | |
# This program is free software: you can redistribute it and/or modify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 29456da2042759c7e8a0c18671b798eab0d2b860 | |
Author: Mike Kazantsev <[email protected]> | |
Date: Sat Sep 22 16:30:02 2012 +0600 | |
Add "optional_no_ca" option to ssl_verify_client to enable app-only CA chain validation | |
diff --git a/src/event/ngx_event_openssl.h b/src/event/ngx_event_openssl.h | |
index cd6d885..97da051 100644 | |
--- a/src/event/ngx_event_openssl.h | |
+++ b/src/event/ngx_event_openssl.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% ./tree_change_costs.py -h | |
usage: tree_change_costs.py [-h] [-r path] [-f float] [-m int] [-d] | |
file_src [file_dst] | |
Change tech tree node cost values. | |
positional arguments: | |
file_src File to edit. In-place, if no file_dst specified. | |
file_dst File to output results to (optional). "-" for output | |
to stdout. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import itertools as it, operator as op, functools as ft | |
import os, sys, errno, argparse, logging, secrets, re, json, shutil | |
import contextlib, inspect, tempfile, pathlib, collections, enum | |
import asyncio, asyncio.subprocess, socket, signal, heapq, struct | |
import aiohttp | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% cat /proc/interrupts | |
CPU0 CPU1 CPU2 CPU3 | |
0: 8163 34453 302107 16401340 IO-APIC 2-edge timer | |
1: 0 0 0 2 IO-APIC 1-edge i8042 | |
8: 0 0 0 1 IO-APIC 8-edge rtc0 | |
9: 0 0 0 2 IO-APIC 9-fasteoi acpi | |
12: 0 0 0 4 IO-APIC 12-edge i8042 | |
16: 12 132 16341 1209542 IO-APIC 16-fasteoi snd_hda_intel:card0 | |
17: 7 37 3501 251541 IO-APIC 17-fasteoi ehci_hcd:usb1, ehci_hcd:usb2, ehci_hcd:usb3 | |
18: 0 0 0 4 IO-APIC 18-fasteoi ohci_hcd:usb4, ohci_hcd:usb5, ohci_hcd:usb6, ohci_hcd:usb7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIWorkshiftUpdate = function(self, building, shift) | |
-- function num : 0_56 , upvalues : shift_names, _ENV, WorkerSlot, OpenSlot, ClosedSlot | |
self:SetRolloverTitle(shift_names[shift]) | |
local training = not building:IsKindOf("TrainingBuilding") or building.max_visitors > 0 | |
local workplace = not building:IsKindOf("Workplace") or building.max_workers > 0 | |
local shift_active = building:IsShiftUIActive(shift) | |
local shift_closed = building:IsClosedShift(shift) | |
if workplace then | |
local shift_overtime = (building.overtime)[shift] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time, contextlib, struct, json | |
import uwsgi | |
def token_bucket(interval, burst=1): | |
token_fmt = '>dL' | |
token_len = struct.calcsize(token_fmt) | |
token_get = lambda: struct.unpack(token_fmt, uwsgi.sharedarea_read(0, token_len)) | |
token_set = lambda *v: uwsgi.sharedarea_write(0, struct.pack(token_fmt, *v)) | |
token_set(time.monotonic(), burst) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lz4.block | |
import struct, pathlib, sys | |
file_src = sys.argv[1] | |
file_dst = sys.argv[1] + '.dec' | |
data = pathlib.Path(file_src).read_bytes() | |
size, = struct.unpack('=I', data[4:8]) | |
payload = data[16:] | |
payload_dec = lz4.block.decompress(payload, size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function run_my_mod() | |
... | |
end | |
function OnMsg.LoadGame() | |
xpcall(run_my_mod, function(err) | |
WaitCustomPopupNotification( | |
'ERROR when running mod', | |
string.format('----- Details:\n%s\n%s\n----- :end\n', err, debug.traceback()), | |
{'Oops!'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
result = sin(degrees*60) / 4096 | |
the argument should be multiplied by 60 | |
the result should be divided by 4096 | |
this is because both the argument and results are integers | |
so | |
sin(90 * 60) will be 4096 | |
cos(0 * 60) will be again 4096 | |
and sin(45 * 60) / 4096.0 will be around 0.70710678 |
OlderNewer