Skip to content

Instantly share code, notes, and snippets.

View nanoant's full-sized avatar

Adam Strzelecki nanoant

View GitHub Profile
@nanoant
nanoant / import_youtube_takeout.py
Created January 5, 2023 12:05
Imports YouTube Takeout playlists CSVs in Python
#!/usr/bin/env python
#
# Copyright (c) 2023 Adam Strzelecki
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@nanoant
nanoant / build-toolchain-gd32v.sh
Last active December 30, 2022 01:18
Builds GD32V riscv-gnu-toolchain on macOS
#!/bin/bash
#
# Builds GD32V riscv-gnu-toolchain on macOS
#
# Author: Adam Strzelecki <nanoant@users.noreply.github.com>
# Released under MIT license.
#
# Assumes HomeBrew is installed and following packages too:
# brew install python3 gawk gnu-sed gmp mpfr libmpc isl zlib expat
#
@nanoant
nanoant / HidGuardianHelper.cs
Created June 28, 2020 14:55
Simple service that whitelists nvcontainer process responsible for XBOX controller emulation for NVIDIA Shield Controller
//
// Simple service that whitelists nvcontainer process responsible for XBOX controller emulation for NVIDIA Shield Controller
//
// Copyright (c) 2020 Adam Strzelecki
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@nanoant
nanoant / icget.swift
Created August 13, 2019 17:50 — forked from anongit/icget.swift
Download .icloud files
// See: https://apple.stackexchange.com/questions/328329/is-there-a-way-via-the-command-line-to-cause-icloud-files-to-download
import Foundation
func main() {
let fm = FileManager.default
for path in CommandLine.arguments[1...] {
let url = NSURL.fileURL(withPath: path)
guard fm.fileExists(atPath: url.path) else {
@nanoant
nanoant / Win32DirectWrite.cpp
Last active August 16, 2022 01:41
DirectWrite rendering demonstration using Win32 API
// just build with: cl Win32DirectWrite.cpp
#include <stdio.h>
#include <stdarg.h>
#include <math.h>
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <d2d1.h>
@nanoant
nanoant / pre-receive
Last active December 10, 2015 19:35 — forked from iley/pre-receive
pre-receive hook to deny pushing big files
#!/usr/bin/perl -wl
use strict;
my $limit = 20 * 1024 * 1024;
my $hasBadFiles;
# human friendly sizes
sub hsize {
# http://www.perlmonks.org/?node_id=378580
(sort { length $a <=> length $b } map { sprintf '%.2g %s',
@nanoant
nanoant / gitlab_api_enable_bcrypt_password_hash.patch
Created November 30, 2015 20:27
Enables exporting bcrypt password hash using GitLab API when using admin token
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 883a5e1..5c08707 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -29,6 +29,7 @@ module API
expose :can_create_group?, as: :can_create_group
expose :can_create_project?, as: :can_create_project
expose :two_factor_enabled
+ expose :encrypted_password, as: :password_hash # custom patch
end
@nanoant
nanoant / git-large-files
Created November 12, 2015 17:35
Show large files in Git repository
#!/usr/bin/env python
#
# Print list of large files in Git
# Copyright (c) 2015 Adam Strzelecki
#
# Installation:
# Place it somewhere in your path, then use with `git large-files'
#
import os, sys, re
import macros
# macro dump(st: stmt): stmt =
# echo st.treeRepr
macro dump(ex: expr): expr =
echo ex.treeRepr
ex
proc test() {.dump.} =
@nanoant
nanoant / deadstore.nim
Created May 27, 2015 13:36
deadstore.nim
{.deadCodeElim: on.}
proc getValue(): int {.inline, noSideEffect.} =
debugEcho "got 1"
result = 1
let x = getValue()
let y = getValue()
echo y