Skip to content

Instantly share code, notes, and snippets.

View drinkius's full-sized avatar

Alexander Telegin drinkius

View GitHub Profile
@pryce-turner
pryce-turner / airgap.md
Last active December 25, 2022 14:33
Air-gapped Raspberry Pi for eth2-deposit-cli

Motivation

The greatest strength of an airgapped machine is also it's biggest headache - no way out! This is a short guide for configuring an old Raspberry Pi 2 (no radio cards!) to securely use the eth2-deposit-cli tool. Whether using an existing mnemonic or generating a new one, the security conscious will appreciate doing so on a machine which never has and never will touch any network.


Requirements

  • Raspberry Pi
  • min 16Gb microSD
@drinkius
drinkius / AppleWKRemapper.ahk
Created September 23, 2018 20:41 — forked from nomand/AppleWKRemapper.ahk
AutoHotKey script that allows Apple wireless keyboard work in Windows 10 with some layout changes. See header for details and credits to original authors and modders.
;===========================================================================================================================================
; Additional Modifications by nomand
;==========================================================================================================================================
;
; - fixed Media_Next functinality
; - moved Eject key screenshots to active window screenshot shortcut (Ctrl+F3)
; - restored Lctrl <> Fn swap
; - restored page up/down, home/end functinality
; - F12 Insert remap kept disabled
; - cleaned up code indentations and comments
@nomand
nomand / AppleWKRemapper.ahk
Last active December 2, 2021 02:05 — forked from TheZoc/AppleWKRemapper.ahk
AutoHotKey script that allows Apple wireless keyboard work in Windows 10 with some layout changes. See header for details and credits to original authors and modders.
;===========================================================================================================================================
; Additional Modifications by nomand
;==========================================================================================================================================
;
; - fixed Media_Next functinality
; - moved Eject key screenshots to active window screenshot shortcut (Ctrl+F3)
; - restored Lctrl <> Fn swap
; - restored page up/down, home/end functinality
; - F12 Insert remap kept disabled
; - cleaned up code indentations and comments
@drinkius
drinkius / gist:f33dcdafb6fe72d7a0205788fe9fb21e
Created July 17, 2017 08:05
Left/right segues, Swift 3
extension UIStoryboardSegue {
func presentWith(direction: SegueTransitionDirection) {
let offset: CGFloat
switch direction {
case .right:
offset = -1
case .left:
offset = 1
}
let firstClassView = self.source.view

Note: This is an older post that I did back when I thought I might have time to be a blogger. Oh I was oh so wrong. However, it has proven useful for some folks on stackoverflow. Thus I'm keeping it alive here on Gist.

One of my past projects dealt heavily with an open source Apple technology called HTTP Live Streaming. It’s an HTTP based streaming protocol that at its most fundamental level provides a way to stream video and audio from just about any server with nothing but a few free software tools provided by Apple**. However, it has a few additional features that I think make it a really exciting tool. Yet, I haven’t seen HTTP Live Streaming used very much. This is probably mainly due to the combination of a lack of good/clear documentation, and Apple’s Live Streaming Developer Tools being command line based also make the barrier to entry higher than many developers want to deal with.

The hope is to share my understanding of how to use this technology to:

@drinkius
drinkius / gist:0b66842b3fb05cbab95c121b7361d9ea
Created March 28, 2017 13:41
Save managed object context
NSManagedObjectContext *context = object.managedObjectContext;
while (context != nil) {
NSError *error = nil;
BOOL result = [context save:&error];
NSAssert(result != NO, @"[ERROR]: Context was not saved");
if (result) {
context = context.parentContext;
} else {
@objc public enum AppContextError: Int, CustomStringConvertible, CustomNSError, LocalizedError {
case badParameters
case unknownError
case connectNotSupported
public static var errorDomain: String {
return "AppContextError"
}
@drinkius
drinkius / how-to-connect-an-iOS-device-to-your-computer-using-SOCKS.md How to connect an iOS device to your computer via a SOCKS proxy. Say you're running a virtual machine on your work computer. Say this machine, for whatever reason, can only connect to the internet over NAT - as in, it does not get it's own IP address. Say this VM is running a webserver, and you need a device outside of your computer to connect t…

How to connect an iOS device to your computer via a SOCKS proxy

Say you're running a virtual machine on your work computer. Say this machine, for whatever reason, can only connect to the internet over NAT - as in, it does not get it's own IP address. Say this VM is running a webserver, and you need a device outside of your computer to connect to it.

If only there was a way to get your work computer to 'share' it's network, so that you could get at that VM… Here's how you do it!

For all instructions, I assume your work computer is a mac

  1. Get your computer's IP address:
@drinkius
drinkius / about_swizzling.md
Created February 17, 2017 13:46 — forked from dodikk/about_swizzling.md
Поговорки про swizzling
  • с утра посвизлил - весь день свободен
  • украл, посвиззлил - в тюрьму
  • волков бояться - в лесу не свиззлить
  • не все золото что свиззлит
  • свиззлинг - всему голова
  • и рыбку съесть, и посвиззлить
  • в большой семье свиззлом не щелкают
func setupGradientBackground() {
let firstColor = UIColor.black.withAlphaComponent(0.6)
let secondColor = UIColor.black.withAlphaComponent(0.0)
let gradient = CGGradient.with(easing: Cubic.EaseIn, between: firstColor, and: secondColor)
var updatedSize = self.navigationBar.bounds.size
updatedSize.height += 20
UIGraphicsBeginImageContextWithOptions(updatedSize, false, 0);