Skip to content

Instantly share code, notes, and snippets.

@herotux
herotux / admin.py
Created May 11, 2018 11:32 — forked from padurets/admin.py
django rest api framework session auth example
from django.contrib import admin
from .models import User
admin.site.register([User])
@Tolerant
Tolerant / convert_guid_to_hex_string.sql
Created May 3, 2018 11:17
Convert 1с guid to HEX string
SELECT TOP 10
CONVERT(UNIQUEIDENTIFIER, CONVERT(BINARY(16), Fld)) AS guid
FROM [DATABASE]..[Info]
ORDER BY _Period DESC;
Story:
My hdd is 1tb but i bought a 256gb ssd. I partitioned it accordingly:
140gb windows
50gb ubuntu
50gb fedora
1gb linux boot
250mb efi system
I want to move operating system files to ssd to make my development env faster, and my documents to hdd.
@DawidMyslak
DawidMyslak / vue.md
Last active April 22, 2024 12:49
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modifying state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.

@shaliko
shaliko / .gitlab-ci.yml
Created August 21, 2017 15:13
GitLab Continuous Integration with Capistrano 3
deploy:
environment: production
stage: deploy
script:
- which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
- ssh-add <(echo -e “$SSH_PRIVATE_KEY”)
- gem install capistrano
- cap staging deploy
@crittermike
crittermike / wget.sh
Last active March 28, 2025 18:44
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@anlek
anlek / application.scss
Last active April 30, 2020 13:51
My current work around for simple_form and Bootstrap 4 beta to work together (till simple_form allows input fields to have `is-invalid` set on it on error - see https://github.com/plataformatec/simple_form/pull/1476)
// Fix for validations on simple form
// Need to import bootstrap functions and mixins if you want to dynamically set colors
// Otherwise replace theme-color... with hex color
@import 'bootstrap/functions';
@import 'bootstrap/variables';
@import 'bootstrap/mixins';
.has-invalid {
.invalid-feedback {
@mixxorz
mixxorz / services.py
Last active January 21, 2020 16:52
Django Service Objects
from django import forms
from django.core.exceptions import ValidationError
from django.db import transaction
class InvalidInputsError(Exception):
def __init__(self, errors, non_field_errors):
self.errors = errors
self.non_field_errors = non_field_errors
@mistakia
mistakia / Readme.MD
Last active March 6, 2018 23:48
Python script to check Nanopool api (every 5 minutes) and restart machine when hashrate is 0.

Edit check.py and set your worker name, wallet address, email info, and google app password.

Make it executable

chmod +x check.py

Setup root's crontab (root needed to reboot)

sudo crontab -e
@numberoverzero
numberoverzero / run_scheduled.py
Last active February 16, 2020 07:58
00.async.periodic.rst
import asyncio
import functools
import json
import secrets
import aiohttp
from concurrent.futures import ALL_COMPLETED