Skip to content

Instantly share code, notes, and snippets.

View depau's full-sized avatar

Davide Depau depau

View GitHub Profile
@ohader
ohader / rename-git-master-branch.sh
Created November 29, 2021 11:31
Rename Git master to main branch via GitHub API
#!/bin/bash
#
# replace `GITHUBTOKEN` with custom token from https://github.com/settings/tokens, having `repo` admin access
#
for repo in $(curl -s -H "Authorization: token GITHUBTOKEN" 'https://api.github.com/orgs/TYPO3-CMS/repos?per_page=100' | jq -r '.[] | .url' | sort)
do
echo "Renaming ${repo}..."
response=$(curl -s -X POST \
@woodrow
woodrow / fido_u2f_dissector.lua
Created December 16, 2019 05:14
wireshark fido/u2f dissector
-- started based on https://gist.github.com/z4yx/218116240e2759759b239d16fed787ca
cbor = Dissector.get("cbor")
iso7816 = Dissector.get("iso7816")
ctaphid_proto = Proto("CTAPHID","FIDO Client to Authenticator Protocol over USB HID")
ctaphidfield_cid = ProtoField.uint32("ctaphid.cid", "Channel ID", base.HEX)
ctaphidfield_cmd = ProtoField.uint8("ctaphid.cmd", "Command", base.HEX)
ctaphidfield_bcnt = ProtoField.uint16("ctaphid.bcnt", "Payload Length", base.DEC_HEX)
ctaphidfield_seq = ProtoField.uint8("ctaphid.seq", "Packet Sequence", base.HEX)
@eiselekd
eiselekd / enableDCI.txt
Last active December 13, 2024 10:01
Enable DCI debugging on Gigabyte-BKi5HA-7200
Enable DCI debugging on Gigabyte-BKi5HA-7200
--------------------------------------------
The Gigabyte-BKi5HA-7200 (Kabylake i5-7200 processor) can be debugged with only a USB debug cable, a
special cable that crosses only the data signals and has the power signals
removed. You can buy these cables at i.e. https://www.datapro.net/products/usb-3-0-super-speed-a-a-debugging-cable.html
The hurdle you have to overcome before you can access DCI however is that you
need to set some bits in hardware that first enable DCI and also enable the debug port so that DCI can control the cores.
There are lots of guides in howto patch the BIOS but only these two really describes all the steps using only freely accessible tools:
@teknoraver
teknoraver / unixhttpc.go
Last active November 7, 2024 14:29
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"
@awave1
awave1 / Blur.java
Created May 6, 2016 17:54
Blur drawable or bitmap on android using renderscript
public static class Blur {
private static final float BLUR_RADIUS = 20.5f; // 25 is maximum radius
// returns blur drawable if api >= 17. returns original drawable if not.
@Nullable
public static Drawable applyBlur(Drawable drawable, Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
Bitmap fromDrawable = drawableToBitmap(drawable);
int width = Math.round(fromDrawable.getWidth() * 0.8f);
@jonsuh
jonsuh / .bash_profile
Last active January 20, 2025 10:27
Bash echo in color
# ----------------------------------
# Colors
# ----------------------------------
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
@stefanschmidt
stefanschmidt / remove-annotations.sh
Last active March 15, 2025 17:36
Remove all annotations from a PDF document
pdftk original.pdf output uncompressed.pdf uncompress
LANG=C sed -n '/^\/Annots/!p' uncompressed.pdf > stripped.pdf
pdftk stripped.pdf output final.pdf compress