Skip to content

Instantly share code, notes, and snippets.

View andrzejkaszkowiak's full-sized avatar

Andrzej Kaszkowiak andrzejkaszkowiak

  • Poland
View GitHub Profile
@andrzejkaszkowiak
andrzejkaszkowiak / bootcamp-invert-scroll.ps1
Last active July 28, 2016 08:30
Inverting direction of trackpad scroll in Windows (Bootcamp)
# Source: http://superuser.com/a/364353
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
@andrzejkaszkowiak
andrzejkaszkowiak / cygwin-change-homedir.sh
Created April 21, 2015 14:49
Safely change home directory in cygwin
# Source: http://stackoverflow.com/a/327235
mkpasswd -l -p "$(cygpath -H)" > /etc/passwd
@andrzejkaszkowiak
andrzejkaszkowiak / .gitconfig_alias
Last active July 28, 2016 08:31
Some essential aliases for .gitconfig
[alias]
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
last = log -1 --stat HEAD
undo = reset --hard
unstage = reset HEAD --
fuckit = !git clean -f -d -x && git reset --hard
@andrzejkaszkowiak
andrzejkaszkowiak / sudoku2.cpp
Last active August 29, 2015 14:20
Sudoku solver by PM of Singapore, Lee Hsien Loong - Interested by the discussion on Hacker News: https://news.ycombinator.com/item?id=9485237
#include "stdio.h"
int InBlock[81], InRow[81], InCol[81];
const int BLANK = 0;
const int ONES = 0x3fe; // Binary 1111111110
int Entry[81]; // Records entries 1-9 in the grid, as the corresponding bit set to 1
int Block[9], Row[9], Col[9]; // Each int is a 9-bit array
---
foreach (var uid in this.uids)
{
var kinect = KinectSensor.KinectSensors.FirstOrDefault(
k => k.Status == KinectStatus.Connected && k.UniqueKinectId.Contains(uid));
if (kinect != null) this.sensors.Add(kinect);
}
+++
@andrzejkaszkowiak
andrzejkaszkowiak / Program.cs
Created January 4, 2016 14:28
Simple asterisk tree
namespace ConsoleApplication
{
using System;
using System.Text;
public class Program
{
public static void Main(string[] args)
{
Console.Write("Pass a number: ");
@andrzejkaszkowiak
andrzejkaszkowiak / chapter_marks.sh
Created January 29, 2016 09:28 — forked from John07/chapter_marks.sh
Read a podcast mp3 file and print a list of its chapter marks. Useful if your podcast client of choice doesn't yet support chapter marks
# read a podcast mp3 file and print a list of its chapter marks
ffprobe -v quiet -show_chapters -pretty -print_format csv *.mp3
# more readable, timestamps with seconds
ffprobe -v quiet -show_chapters -pretty -print_format csv *.mp3 | awk -F "," '{print $5 " " $7 " " $8}' | sed 's/\.[0-9]*\ /\ /g'
# more readable, timestamps without seconds
ffprobe -v quiet -show_chapters -pretty -print_format csv *.mp3 | awk -F "," '{print $5 " " $7 " " $8}' | sed 's/\:[0-9][0-9]\.[0-9]*\ /\ /g'

Keybase proof

I hereby claim:

  • I am venedie on github.
  • I am venedie (https://keybase.io/venedie) on keybase.
  • I have a public key ASC0RhFlBrEL9eQ-k0o4V9JZxgfP9_h925ui-uOC9l-rEQo

To claim this, I am signing this object:

@andrzejkaszkowiak
andrzejkaszkowiak / .gitconfig
Created December 24, 2016 05:03 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@andrzejkaszkowiak
andrzejkaszkowiak / .gitconfig
Created December 24, 2016 05:09 — forked from robmiller/.gitconfig
A few useful commands for working with branches
# git branch-name: prints the name of the branch in a safe/scriptable/non-porcelain way
# git publish: publishes the current branch on the remote "origin", using the same name as the current branch
# git unpublish: deletes the remote branch with the same name as the current one (potentially destructive)
# git recreate: given a branch name, recreates the branch with that name from the latest master. Deletes both the local and remote copy of the branch first. Very destructive, use with caution
branch-name = "!git rev-parse --abbrev-ref HEAD"
publish = "!git push -u origin $(git branch-name)"
unpublish = "!git push origin :$(git branch-name)"
recreate = "!f() { [[ -n $@ ]] && git checkout \"$@\" && git unpublish && git checkout master && git branch -D \"$@\" && git checkout -b \"$@\" && git publish; }; f"