Skip to content

Instantly share code, notes, and snippets.

@aaronjanse
aaronjanse / fix.sh
Created August 21, 2017 14:37
Magical command to make gpg work with YubiKey smartcard
killall gpg-agent && gpg-agent --daemon --use-standard-socket --pinentry-program /usr/local/bin/pinentry
@damonjw
damonjw / LICENSE
Last active October 13, 2024 18:18
Event driven simulator in Python, using async/await
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
@scintill
scintill / README.md
Created June 5, 2017 00:27
redirect syslog to stderr

LD_PRELOAD this as a library to output a binary's output from syslog() on stderr as well as any syslog daemon that's listening (useful for Docker, if you want all log output to be collected by Docker's standard output handling.) Beware though, if the program changes its stderr file descriptor (closes it, points it at /dev/null, pipes it out to a socket), this can have surprising results. For example, when I tried this with cyrus-imapd, I was getting syslog output sent to remote clients because stderr and stdout were remapped that way (not maintaing the original fd that Docker set up.)

Example Docker implementation

COPY syslog2stderr.c /build
RUN gcc -fPIC -shared /build/syslog2stderr.c -o /usr/local/lib/syslog2stderr.so
RUN echo /usr/local/lib/syslog2stderr.so >> /etc/ld.so.preload
@Jinmo
Jinmo / jni_all.h
Created May 26, 2017 07:36
Useful when reversing JNI on IDA Pro
/*
* Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
@z-rui
z-rui / 1.txt
Created March 31, 2017 15:41
通用规范汉字表 (2013)
@JCBuck
JCBuck / WindowsDiscoveries.md
Last active June 28, 2020 10:39
Neat and random discoveries in Windows

connect.dll CLSID GUID symbols (some may be used for xwizard.exe RunWizard [GUID] ) (10.0.14393.0)

00007FFF0C1FE398  Export  CLSID_ConnectToInternetCreationHookPage           {7071ECA5-663B-4BC1-A1FA-B97F3B917C55}
00007FFF0C1FE3A8  Export  CLSID_ConnectToInternetFinishPage                 {7071ECAF-663B-4BC1-A1FA-B97F3B917C55}
00007FFF0C1FE3B8  Export  CLSID_ConnectToInternetDetectionHookPage          {7071ECA3-663B-4BC1-A1FA-B97F3B917C55}
00007FFF0C1FE3C8  Export  CLSID_ConnectToInternetHookPage                   {7071ECA8-663B-4BC1-A1FA-B97F3B917C55}
00007FFF0C1FE3D8  Export  CLSID_DisplayWorkExistingConnectionsPage          {7071EC62-663B-4BC1-A1FA-B97F3B917C55}
00007FFF0C1FE3E8  Export  CLSID_NetworkTasksHost                            {7071ECFA-663B-4BC1-A1FA-B97F3B917C55}
00007FFF0C1FE3F8  Export  CLSID_ConnectToWorkExistingConnectionsPage        {7071ECB4-663B-4BC1-A1FA-B97F3B917C55}
@integeruser
integeruser / s-rand.py
Last active September 24, 2023 14:09
Python port of the GLIBC rng
#!/usr/bin/env python2
from ctypes import c_int, c_uint
# http://www.mscs.dal.ca/~selinger/random/
def srand(seed):
srand.r = [0 for _ in range(34)]
srand.r[0] = c_int(seed).value
for i in range(1, 31):
@raecoo
raecoo / console.save.js
Last active January 11, 2025 05:52
Save JSON object to file in Chrome Devtool
// e.g. console.save({hello: 'world'})
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
if(typeof data === "object"){
data = JSON.stringify(data, undefined, 4)
@zmwangx
zmwangx / # macOS release checksums
Last active February 8, 2020 02:33
macOS / OS X installer checksums. When I don't have a particular image, I filled as many fields as possible with data from https://github.com/notpeter/apple-installer-checksums and/or https://github.com/drduh/macOS-Security-and-Privacy-Guide/blob/master/InstallESD_Hashes.csv. A list of build numbers can be found in the Apple Support article http…
We couldn’t find that file to show.
@tsaarni
tsaarni / openssl-notes.txt
Created October 22, 2016 08:50
Generate self-signed certs with different key types
*** RSA
# Generate self-signed certificate with RSA 4096 key-pair
openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout rsakey.pem -out rsacert.pem
# print private and public key
openssl rsa -in rsakey.pem -text -noout
# print certificate
openssl x509 -in rsacert.pem -text -noout