Skip to content

Instantly share code, notes, and snippets.

@amitchhajer
amitchhajer / Count Code lines
Created January 5, 2013 11:08
Count number of code lines in git repository per user
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n
@albrow
albrow / confirm.go
Last active April 16, 2023 03:03
Go (golang): How to ask for user confirmation via command line
import (
"fmt"
"log"
"os"
"sort"
)
// askForConfirmation uses Scanln to parse user input. A user must type in "yes" or "no" and
// then press enter. It has fuzzy matching, so "y", "Y", "yes", "YES", and "Yes" all count as
// confirmations. If the input is not recognized, it will ask again. The function does not return
@dvliman
dvliman / gist:11264471
Created April 24, 2014 18:24
4chan source code leak
<?
if(file_exists('/www/global/lockdown')) {
if($_COOKIE['4chan_auser'] && $_COOKIE['4chan_apass'] && ($_POST['mode']=='usrdel'||$_GET['mode']=='latest')) {
// ok
}
else {
die('Posting temporarily disabled. Come back later!<br/>&mdash;Team 4chan (uptime? what\'s that?)');
}
}
include_once "./yotsuba_config.php";
@pjdietz
pjdietz / rfc3339.js
Last active May 27, 2024 12:25
Format a local date as an RFC 3339 date with timezone
function rfc3339(d) {
function pad(n) {
return n < 10 ? "0" + n : n;
}
function timezoneOffset(offset) {
var sign;
if (offset === 0) {
return "Z";

radare2

load without any analysis (file header at offset 0x0): r2 -n /path/to/file

  • analyze all: aa
  • show sections: iS
  • list functions: afl
  • list imports: ii
  • list entrypoints: ie
  • seek to function: s sym.main
@SKempin
SKempin / Git Subtree basics.md
Last active October 23, 2024 04:12
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@mariomadproductions
mariomadproductions / debug_games.md
Last active April 27, 2024 10:12 — forked from unreceptive/debug_games.md
List of video games shipped with debug symbols.

List of any video game shipped with debugging symbols.

Contributions are welcome.

Name Version Platform Notes
Brunswick Pro Bowling Unknown Nintendo 3DS Contains an ELF binary with full symbol information in its RomFS root
Fire Emblem: If/Fates All (double check) Nintendo 3DS All released versions of the game contain "name.StackTrace" and "addr.StackTrace" files in the "debug" folder in the RomFS, which provide full function names/signatures for the game's code.bin
Inazuma Eleven 3 Lightning Bolt / Team Ogre Attacks / Bomb Blast Unknown Nintendo 3DS CRO/CRS contains symbols
The Legend of Zelda: The Wind Waker n/a Nintendo GameCube
@miguelmota
miguelmota / notes.md
Last active October 26, 2023 08:37
BIP32 vs BIP39 vs BIP44
  • BIP32 - is a method for generating a tree of private keys from a master private key.
  • BIP39 - is a method for encoding 128-256 bits of random data into 12-24 word phrases from a list of interchangeable 2018 words, and then turn those phrases into a 64-byte hash.
  • BIP44 - is a method for structuring a private key tree in a specific way that will facilitate usage/restoration/discovery of multiple accounts for multiple purposes.
@lcrilly
lcrilly / README.md
Last active November 3, 2024 07:43
NGINX OAuth 2.0 Token Introspection

OAuth 2.0 Token Introspection with NGINX and njs

This configuration enables NGINX to validate an authentication token against an authorization server by using OAuth 2.0 Token Introspection (RFC 7662). This solution uses the auth_request module and the NGINX JavaScript module to require authentication and perform the token introspection request.

By default, the client's authentication token is expected as a bearer token supplied in the Authorization header. If supplied elsewhere in the HTTP request, the $access_token variable must be configured to specify where to obtain the token.

Token introspection requests are authenticated. By default, the $oauth_client_id and $oauth_client_secret variables are used to perform HTTP Basic authentication with the Authorization Server. If only the $oauth_client_secret variable is specified then that value is used

This file has been truncated, but you can view the full file.
.text section layout
00000000 000084 80006e00 00002fe0 4 __dt__Q44nw4r2ut6detail12LinkListImplFv libnw4r_ut.a ut_LinkList.o
00000084 000048 80006e84 00003064 4 Erase__Q44nw4r2ut6detail12LinkListImplFQ54nw4r2ut6detail12LinkListImpl8Iterator libnw4r_ut.a ut_LinkList.o
000000cc 00002c 80006ecc 000030ac 4 Insert__Q44nw4r2ut6detail12LinkListImplFQ54nw4r2ut6detail12LinkListImpl8IteratorPQ34nw4r2ut12LinkListNode libnw4r_ut.a ut_LinkList.o
000000f8 000030 80006ef8 000030d8 4 Erase__Q44nw4r2ut6detail12LinkListImplFPQ34nw4r2ut12LinkListNode libnw4r_ut.a ut_LinkList.o
00000128 000074 80006f28 00003108 4 IsValidBinaryFile__Q24nw4r2utFPCQ34nw4r2ut16BinaryFileHeaderUlUsUs libnw4r_ut.a ut_binaryFileFormat.o
0000019c 000078 80006f9c 0000317c 4 ReadNextCharUTF8__Q34nw4r2ut14CharStrmReaderFv libnw4r_ut.a ut_CharStrmReader.o
00000214 00001c 80007014 000031f4 4 ReadNextCharUTF16__Q34nw4r2ut14CharStrmReaderFv libnw4r_ut.a ut_CharStrmReader.o
00000230 00001c 80007030 00003210 4 ReadNextCharCP1252__Q