Skip to content

Instantly share code, notes, and snippets.

View MarcinKonowalczyk's full-sized avatar
😴
Sleeping

Marcin Konowalczyk MarcinKonowalczyk

😴
Sleeping
View GitHub Profile
@ikey4u
ikey4u / svg2icns.sh
Created February 27, 2020 03:36
Generate Mac icns icon from svg using inkscape
inkscape=/Applications/Inkscape.app/Contents/MacOS/inkscape
insvg=burpicon.svg
output=burp
outdir=${output}.iconset
mkdir $outdir
for sz in 16 32 128 256 512
do
echo "[+] Generete ${sz}x${sz} png..."
$inkscape --without-gui --export-file ${outdir}/icon_${sz}x${sz}.png -w $sz -h $sz $insvg
@tamsanh
tamsanh / shifty.py
Created April 30, 2018 23:09
Python __rshift__ __lshift __rrshift__ __rlshift__ Examples and Order of Operations
# Setup Classes for the Example
class Shifter:
def __init__(self, label):
self.label = label
def __str__(self):
return str(self.label)
def __rshift__(self, other):
print("#%s.__rshift__(%s)" % (self, other))
@oltolm
oltolm / ptrmath.nim
Last active February 25, 2024 19:17
Nim pointer arithmetic
# from https://forum.nim-lang.org/t/1188#7366 by Jehan
# most of the time only the dereference operator is needed, import it like this:
# from ptrmath import `[]`
template `+`*[T](p: ptr T, off: int): ptr T =
cast[ptr type(p[])](cast[ByteAddress](p) +% off * sizeof(p[]))
template `+=`*[T](p: ptr T, off: int) =
p = p + off
@gbaman
gbaman / HowToOTGFast.md
Last active May 14, 2024 10:26
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@mislav
mislav / spotify-remote-patch.sh
Last active May 4, 2023 11:09
Patch installer for OS X `rcd` daemon to make headset remote buttons start/stop Spotify instead of iTunes. The pause/resume functionality still doesn't work unless iTunes is running in the background, for some inexplicable reason.
#!/bin/bash
# Run once to patch `rcd` daemon after creating a backup.
# Run again to restore the backup and revert back to original functionality.
set -eu
if [ "$USER" != "root" ]; then
exec sudo "$0" "$@"
fi
rcd="/System/Library/CoreServices/rcd.app/Contents/MacOS/rcd"
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@statico
statico / gist:3172711
Created July 24, 2012 21:15
How to use a PS3 controller on Mac OS X 10.7 (Lion)

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.