Skip to content

Instantly share code, notes, and snippets.

View dorokhin's full-sized avatar
🎯
Focusing

dorokhin

🎯
Focusing
View GitHub Profile
@dorokhin
dorokhin / 0002_usersession_unique_id.py
Last active August 29, 2019 07:30
Django migrate UUIDField unique=True
from extended_profile.models import UserSession
class Migration(migrations.Migration):
dependencies = [
('extended_profile', '0001_auto_20190829_0714'),
]
def gen_uuid(apps, schema_editor):
@dorokhin
dorokhin / vanillaJS.md
Last active August 26, 2019 21:48
Vanilla JS

Operations with vanilla JavaScript (YOU MIGHT NOT NEED JQUERY)

Selecting elements

// Instead, select the first instance of .box
document.querySelector(".box");
// …or select all instances of .box  
document.querySelectorAll(".box");
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@dorokhin
dorokhin / axios-catch-error.js
Created July 10, 2019 23:52 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@dorokhin
dorokhin / clean-up-boot-partition-ubuntu.md
Created July 1, 2019 04:03 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@dorokhin
dorokhin / bot.rb
Created June 19, 2019 13:30 — forked from dideler/bot.rb
Sending a notification message to Telegram (via cURL)
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
#!/usr/bin/python
"""
LCD-i2c.py
Python module to write to simple character screens with an i2c backpack.
This program uses (modified) parts of lcd_i2c.py by Matt Hawkins, licensed under the
GNU GPL v3 or at your option any later version.
Copyright 2016 Tijndagamer
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
@dorokhin
dorokhin / infra-red-banana.py
Created June 15, 2019 08:33
Infrared banana PI control
#!/usr/bin/python
from evdev import InputDevice, list_devices
from mpd import MPDClient
import socket
import os
def mpd_func(func_name):
try:
c = MPDClient()
c.connect("localhost", 6600)
@dorokhin
dorokhin / miner-stat.py
Created June 15, 2019 06:35
claymore monitoring
#!/usr/bin/env python
import socket
import sys
import json
import time
loop_seconds = 90
miner_ip = '192.168.1.102'
@dorokhin
dorokhin / gitflow-breakdown.md
Created June 14, 2019 12:12 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository