Skip to content

Instantly share code, notes, and snippets.

@dmitryvk
dmitryvk / Cargo.toml
Created March 29, 2020 17:07
Gtk-rs async `alert` example
[package]
name = "async-ui"
version = "0.1.0"
authors = ["Dmitry Kalyanov <Kalyanov.Dmitry@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
futures = "0.3.4"
@mikepfeiffer
mikepfeiffer / stress.sh
Created January 27, 2019 21:05
Install Stress Utility on Amazon Linux 2
sudo amazon-linux-extras install epel -y
sudo yum install stress -y
@ubergesundheit
ubergesundheit / readme.md
Last active February 5, 2024 10:46
systemd traefik.service

systemd Service Unit for Traefik

Adapted from caddy systemd Service Unit

The provided file should work with systemd version 219 or later. It might work with earlier versions. The easiest way to check your systemd version is to run systemctl --version.

Instructions

We will assume the following:

#Generate root password
import random, string
password = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(20))
#Download ngrok
! wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
! unzip -qq -n ngrok-stable-linux-amd64.zip
#Setup sshd
! apt-get install -qq -o=Dpkg::Use-Pty=0 openssh-server pwgen > /dev/null
#Set root password
@tammoippen
tammoippen / crappyhist.py
Last active March 20, 2024 17:54
Draw a crappy text-mode histogram of an array (python 3)
import numpy as np
def crappyhist(a, bins=50, width=140):
h, b = np.histogram(a, bins)
for i in range (0, bins):
print('{:12.5f} | {:{width}s} {}'.format(
b[i],
'#'*int(width*h[i]/np.amax(h)),
h[i],
@Seanny123
Seanny123 / phil_lstm.py
Last active September 19, 2017 09:23
Stateful LSTM example
from keras.models import Sequential
from keras.layers import LSTM, Dense
import numpy as np
def gen_sig(num_samples, seq_len):
one_indices = np.random.choice(a=num_samples, size=num_samples // 2, replace=False)
x_val = np.zeros((num_samples, seq_len), dtype=np.bool)
x_val[one_indices, 0] = 1
@jordanorelli
jordanorelli / ydiff
Last active July 22, 2019 13:05
diff yaml trees semantically
#!/usr/bin/env ruby
# diffs the contents of yaml files semantically. that is, ydiff will parse each
# yaml file and then diff their resulting trees, instead of attempting to diff
# the text. it's specifically for comparing directories of translations from
# Crowdin, so it's effectively only concerned with strings.
require 'pathname'
require 'rubygems'
require 'yaml'
@oglops
oglops / yaml_OrderedDict.py
Last active January 25, 2023 11:08
write to and load from yaml file with OrderedDict
#!/usr/bin/env python
try:
# for python newer than 2.7
from collections import OrderedDict
except ImportError:
# use backport from pypi
from ordereddict import OrderedDict
import yaml
@andyshinn
andyshinn / Dockerfile
Created December 24, 2015 19:07
BusyBox cron container example
FROM gliderlabs/alpine:3.3
COPY myawesomescript /bin/myawesomescript
COPY root /var/spool/cron/crontabs/root
RUN chmod +x /bin/myawesomescript
CMD crond -l 2 -f
@u0d7i
u0d7i / disable_vim_auto_visual_on_mouse.txt
Last active February 27, 2024 14:08
Disable vim automatic visual mode on mouse select
Disable vim automatic visual mode on mouse select
issue: :set mouse-=a
add to ~/.vimrc: set mouse-=a
my ~/.vimrc for preserving global defaults and only changing one option:
source $VIMRUNTIME/defaults.vim
set mouse-=a