Skip to content

Instantly share code, notes, and snippets.

View cuiwm's full-sized avatar
🎯
Focusing

cuiwm cuiwm

🎯
Focusing
  • UK
View GitHub Profile
#
# It will:
#
# deal with files with spaces, newlines, leading dashes, and other funniness
# handle an unlimited number of files
# won't repeatedly overwrite your backup.tar.gz like using tar -c with xargs will do when you have a large number of files
# Also see:
#
# GNU tar manual http://www.gnu.org/software/tar/manual/tar.html#SEC107
# How can I build a tar from stdin?, searc
<script type="text/javascript" src="/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/js/jquery.serializejson.js"></script>
<form id="loginform" action="/user/login" method="POST">
<div class="container">
<input type="hidden" name="id" data-value-type="number" value=100 required>
<input type="hidden" name="error" data-value-type="auto" value="null" required>
<input type="hidden" name="message" value="/user/login" required>
<label><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="data[username]" required>
package main
import (
"encoding/hex"
"fmt"
"github.com/ethereum/go-ethereum/crypto"
)
func main() {
package main
import (
"fmt"
"github.com/ethereum/go-ethereum/crypto"
)
//In cryptography, the Elliptic Curve Digital Signature Algorithm (ECDSA) offers a variant of the Digital Signature Algorithm (DSA) which uses elliptic curve cryptography
func main() {
@cuiwm
cuiwm / mysql_tcpdump.sh
Created September 11, 2018 10:45 — forked from ffeast/mysql_tcpdump.sh
Mysql traffic tcpdump one-liner
# a handy one-liner to print out sql queries if you wouldn't like to enable
# queries logging in mysql server itself
tcpdump -i lo -s 0 -l -w - dst port 3306 | strings | perl -e '
while(<>) { chomp; next if /^[^ ]+[ ]*$/;
if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER)/i) {
if (defined $q) { print "$q\n\n"; }
$q=$_;
} else {
$_ =~ s/^[ \t]+//; $q.=" $_";
}
@cuiwm
cuiwm / redisjobqueue.go
Created October 30, 2018 09:53 — forked from brunocassol/redisjobqueue.go
A simple demo implementation of a Redis job queue in Go inspired on http://stackoverflow.com/a/34754632
package main
// A simple demo implementation of a Redis job queue in Go inspired on http://stackoverflow.com/a/34754632
// You'll need to get redis driver package in terminal with: go get -u gopkg.in/redis.v5
// Once it is running, Redis should look like: http://i.imgur.com/P4XlwlP.png
// Terminal should look like: http://i.imgur.com/AS2IIbP.png
// I have 4 days of Go programming experience, have mercy.
import (
"fmt"
@cuiwm
cuiwm / pstack-osx.sh
Created November 1, 2018 07:36 — forked from theirix/pstack-osx.sh
pstack for osx
#!/bin/sh
#
# Script prints gdb stack of the process with a specified pid
if [ -z $1 ]; then
echo "Usage: $0 pid"
exit 1
fi
PID=$1
@cuiwm
cuiwm / gist:56a4446cc24078d0cd1f032a40f3fb66
Created November 1, 2018 10:08 — forked from tobym/gist:3538214
My pwdx implementation for a mac
#!/bin/bash
lsof -a -p $1 -d cwd -n | tail -1 | awk '{print $NF}'
@cuiwm
cuiwm / pwdx_and_portpwdx_for_mac.bash
Created November 1, 2018 10:11 — forked from gerrard00/pwdx_and_portpwdx_for_mac.bash
pwdx for mac. Usage: pwx pid also portpwdx that finds the pwd for the process that owns a port. Usage: portpwdx port
function pwdx {
# note: NF is the number of columns, so $NF gives us the last column
lsof -a -p $1 -d cwd -n | tail -1 | awk '{print $1, "\t", $NF}'
}
function portpwdx {
# pid=$(lsof -i :5858 | tail -1 | perl -pe 's/[^\s]+\s+([^\s]+)\s.*/$1/')
pid=$(lsof -i :$1 | tail -1 | perl -pe 's/[^\s]+\s+([^\s]+)\s.*/$1/')
if [[ ! -z $pid ]]; then
echo $pid
@cuiwm
cuiwm / codesign_gdb.md
Created November 4, 2018 14:13 — forked from gravitylow/codesign_gdb.md
Codesign gdb on macOS

If you are getting this in gdb on macOS while trying to run a program:

Unable to find Mach task port for process-id 57573: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
  1. Open Keychain Access
  2. In menu, open Keychain Access > Certificate Assistant > Create a certificate
  3. Give it a name (e.g. gdbc)