Skip to content

Instantly share code, notes, and snippets.

View dmgl's full-sized avatar
🎯
Focusing

Galochkin D.D. dmgl

🎯
Focusing
  • Russia, Saint-Petersburg
View GitHub Profile
@dmgl
dmgl / dmgl_enable_bluetooth.sh
Created July 22, 2021 15:25
Autoenable bluetooth (added to startup)
#!/usr/bin/env bash
OBJECT_PATH=/org/freedesktop/login1/session/$XDG_SESSION_ID
BUS_NAME=org.freedesktop.login1
UNLOCK="$OBJECT_PATH: $BUS_NAME.Session.Unlock ()"
GDBUS_MONITOR="gdbus monitor --system --dest $BUS_NAME --object-path $OBJECT_PATH"
function log {
@dmgl
dmgl / analyze_kicker_scores_matplotlib.py
Last active September 14, 2020 16:15
Visualization of our kicker game scores (matplotlib)
import re
import json
import matplotlib.pyplot as plt
j_file = open('/home/dmgl/Downloads/Telegram Desktop/ChatExport_2020-09-04/result.json', 'r')
j = json.load(j_file)
s_type = {'type': 'hashtag', 'text': '#scores'}
@dmgl
dmgl / get_tracks.js
Last active September 9, 2020 09:59
Get file csv with vk music tracks
var links,thisLink;
var myCsv;
links = document.getElementsByClassName('audio_row_content _audio_row_content');
for (let item of links) {
title = item.getElementsByClassName('audio_row__title_inner _audio_row__title_inner').item(0).innerText
performer = item.getElementsByClassName('audio_row__performers').item(0).innerText
console.log(performer + " - " + title)
@dmgl
dmgl / dmgl_switch_layout.py
Created September 8, 2020 16:51
Switch layout by CapsLock (added to startup)
#!/usr/bin/env python3
import subprocess
from pynput import keyboard
# Switch layout - Disable
# Compose key - Disable
# ⌘ key behavior - Shortcut Overlay
# Caps Lock bevahior - Disable
@dmgl
dmgl / update-resolv-conf.sh
Last active September 8, 2020 16:41 — forked from janvojt/update-resolv-conf.sh
Script for updating DNS configuration after openvpn creates a new virtual network interface for forwarding traffic into VPN (place /etc/openvpn/scripts)
#!/usr/bin/env bash
#
# Parses DHCP options from openvpn to update resolv.conf
# To use set as 'up' and 'down' script in your openvpn *.conf:
# up /etc/openvpn/update-resolv-conf
# down /etc/openvpn/update-resolv-conf
#
# Used snippets of resolvconf script by Thomas Hood <jdthood@yahoo.co.uk>
# and Chris Hanson
# Licensed under the GNU GPL. See /usr/share/common-licenses/GPL.
@dmgl
dmgl / make_repo_instructions.txt
Last active May 18, 2020 21:26
Instructions for making git repo
# Create a bare repository on the server side.
cd ~/Projects; sudo -u pi mkdir -m 770 project.git
cd project.git; sudo -u pi git --bare init --shared=group
# From client side the developer’s project must be pushed into the new bare server repository:
# First, create a new local git repository and add all files within this folder.
cd dir_with_files; git init; git add .; git commit -m "creation repo"
git remote add origin ssh://pi@address:port/home/pi/Projects/project.git
# Check origin
@dmgl
dmgl / pc.orig
Last active September 8, 2020 16:40 — forked from jonschoning/pc.laptop
Modify /usr/share/X11/xkb/symbols/pc to swap CTRL to ALT key.
default partial alphanumeric_keys modifier_keys
xkb_symbols "pc105" {
key <ESC> { [ Escape ] };
// The extra key on many European keyboards:
key <LSGT> { [ less, greater, bar, brokenbar ] };
// The following keys are common to all layouts.
key <BKSL> { [ backslash, bar ] };
@dmgl
dmgl / how_referer_header_works.py
Last active September 11, 2019 12:20
How HTTP referer works
#!/usr/bin/env python
# save this file and run `python how_referer_header_works.py`
# to stop you can use commnad `lsof -i tcp:9999` and kill pid
# usage: make public post on any site with hlink href http://0.0.0.0:9999 and click on it
# or `curl 0.0.0.0:9999 --referer google.com -H "X-Something: Yeah-yeah-yeah"`
# see output of script with headers section (custom referer)
@dmgl
dmgl / first_start_pi_instructions.txt
Last active January 11, 2018 09:38
First start RaspberryPi instructions
sudo raspi-config # set hostname; ssh, vnc enable; spi enable
sudo leafpad /etc/ssh/sshd_config # set port, listen
sudo apt-get update && sudo apt-get upgrade
sudo apt-get purge bluej scratch greenfoot
rm -rf ~/oldconffiles/ ~/oldconffiles/Scratch
rm -rf ~/Documents/*
sudo dpkg-reconfigure locales
@dmgl
dmgl / application_list_current.txt
Last active September 8, 2020 16:53
My linux application list
dmgl@metal:~$ ls /usr/share/applications | awk -F '.desktop' ' { print $1}' -
4kvideodownloader
apport-gtk
assistant-qt5
bamf-2.index
bluetooth-sendto
ca.desrt.dconf-editor
catfish
cheese