Skip to content

Instantly share code, notes, and snippets.

View Hammer2900's full-sized avatar
🌲
___

Yevhen Ts. Hammer2900

🌲
___
View GitHub Profile
@Hammer2900
Hammer2900 / bluetooth.sh
Created December 2, 2022 09:44 — forked from miguelmota/bluetooth.sh
Arch linux bluetooth connect example
sudo systemctl enable bluetooth.service
sudo systemctl start bluetooth.service
bluetoothctl
[bluetooth]# power on
[bluetooth]# agent on
[bluetooth]# default-agent
[bluetooth]# scan on
[bluetooth]# pair 7C:9A:1D:B3:57:BA
[bluetooth]# connect 7C:9A:1D:B3:57:BA
@Hammer2900
Hammer2900 / nm_l2tp_ipsec_vpn.md
Last active September 1, 2022 05:45 — forked from pastleo/nm_l2tp_ipsec_vpn.md
setup L2TP IPSEC VPN in archlinux using NetworkManager
@Hammer2900
Hammer2900 / i3-smarttitles.py
Created May 26, 2022 14:24 — forked from ericbrandwein/i3-smarttitles.py
Hide or show titles in i3wm windows depending on if the Workspace has more than one window. Requires [i3ipc-python](https://github.com/acrisci/i3ipc-python) to be installed.
#!/usr/bin/env python
import i3ipc
# Create the Connection object that can be used to send commands and subscribe
# to events.
i3 = i3ipc.Connection()
def change_titles(windows):
if len(windows) > 1:
#Принудительно меняем раскладу для Konsole и kitty
#Для телеграм меняем на Русский
#Для всего остального меняю на английский
from i3ipc import Connection, Event
import subprocess,os
@Hammer2900
Hammer2900 / template.py
Created August 25, 2021 09:52 — forked from JohnRipper/template.py
template for i3ipc extensions
#!/usr/bin/env python3
import i3ipc
from i3ipc import Event
from i3ipc.events import IpcBaseEvent, Event
i3 = i3ipc.Connection()
# callback for when workspace focus changes
def on_workspace(i3, e:IpcBaseEvent):
print(e.__dict__)
import macros, strutils
type
TokenKind = enum
FInt, FString, Text
Token = object
case kind: TokenKind
of FInt, FString: nil
of Text: c: String
@Hammer2900
Hammer2900 / bson_to_python_file.py
Created March 3, 2019 19:05 — forked from pomack/bson_to_python_file.py
Convert a MongoDB BSON file to a python file that can be imported.
#!/usr/bin/env python
import argparse
import bson
import datetime
import struct
import sys
INDENT_SPACES = ' '
def read_bson_file(file, as_class=dict, tz_aware=True, uuid_subtype=bson.OLD_UUID_SUBTYPE):
@Hammer2900
Hammer2900 / docker_exec_alias.md
Created February 25, 2019 14:05 — forked from danfergo/docker_exec_alias.md
Aliasing docker exec -it bash

How to alias docker exec (with autocompletion)

Aliasing docker exec -it some_container_name bash to d some_container_name.

Step 1.1 Add to your .bashrc

d(){
    docker exec -it $1 bash
}

Step 1.2 Then source it

@Hammer2900
Hammer2900 / vector.py
Created January 20, 2019 15:02 — forked from mcleonard/vector.py
A vector class in pure python.
"""
The MIT License (MIT)
Copyright (c) 2015 Mat Leonard
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
@Hammer2900
Hammer2900 / py-code-update.py
Created January 15, 2019 06:13 — forked from javierarilos/py-code-update.py
Sample of reloading a class definition in python. Old and new instances point to the correct class definition.
# writing c1 class definition to module mod1
cs = """
class c1(object):
att = 1
def m1(self):
self.__class__.att += 1
# printing class name, class-id, and the id of the class, which happens to be its memory address
print "uno:", self.__class__, "class-id:", id(self.__class__), "att:", self.__class__.att
"""