Skip to content

Instantly share code, notes, and snippets.

View phofman's full-sized avatar

Paweł Hofman phofman

View GitHub Profile
@mirhec
mirhec / raspi-setup-gitea.md
Created September 20, 2017 07:14
Installing Gitea on Raspberry Pi with nginx, SSL and automatic backups

Setup Gitea on Raspberry Pi (3)

These instructions are based on this article: https://www.alexruf.net/2016/05/23/setup-gogs-git-service.html.

Setup Raspberry Pi with minimal Raspbian image. You need to connect to the HDMI port and set the following:

sudo raspi-config

There you need to enable the SSH server and you should change the hostname.

@soffes
soffes / Rakefile
Last active January 16, 2023 16:37
Programmatically build and sign a Developer ID macOS app
TEAM_ID = 'XXXXXXXXXX'
APP_NAME = 'My App'
SCHEME_NAME = APP_NAME
desc 'Create a beta build'
task :build do
# Ensure clean git state
unless system 'git diff-index --quiet HEAD --'
abort 'Failed. You have uncommitted changes.'
end
@simonw
simonw / recover_source_code.md
Last active January 16, 2024 08:13
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@royshil
royshil / AndroidCamera2TouchToFocus.java
Last active May 4, 2024 02:51
How to implement Touch-to-Focus in Android using Camera2 APIs
//Override in your touch-enabled view (this can be differen than the view you use for displaying the cam preview)
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
final int actionMasked = motionEvent.getActionMasked();
if (actionMasked != MotionEvent.ACTION_DOWN) {
return false;
}
if (mManualFocusEngaged) {
Log.d(TAG, "Manual focus already engaged");
return true;
@kizbitz
kizbitz / dockerhub-v2-api-user.sh
Last active April 17, 2023 23:30
Get the list of images and tags for a Docker Hub user account.
#!/bin/bash
# Example for the Docker Hub V2 API
# Returns all imagas and tags associated with a Docker Hub user account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username and password
UNAME=""
UPASS=""
@rdp
rdp / send_ctrl_c.c
Last active December 20, 2023 08:02
// attribution: http://stackoverflow.com/a/15281070/32453
// you can compile this with gcc [mingw or mingw-w64] and probably other compilers as well
#include <stdlib.h> // NULL
#include <stdbool.h> // false
#include <windows.h> // AttachConsole, CTRL_C_EVENT, etc.
#include <stdio.h> // printf
#include <strsafe.h>
void logLastError()
@guipacheco2
guipacheco2 / DisplayVendorID-1e6d.DisplayProductID-59f2
Last active October 29, 2023 05:55
How to force RGB in Mac OS X
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DisplayProductName</key>
<string>Display with forced RGB mode (EDID override)</string>
<key>IODisplayEDID</key>
<data>AP///////wAebfJZAQEBAQEXAQSlQxx4hsqVplVOoSYPUFSlS4BxT4GAgcCp
wLMAAQEBAQEBfkgA4KA4H0BAQDoApSIhAAAYAjqAGHE4LUBYLEUApSIhAAAa
AAAA/ABMRyBVTFRSQVdJREUKAAAA/QA4Sx5aGAAKICAgICAgAMc=
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten