Skip to content

Instantly share code, notes, and snippets.

View Emilgardis's full-sized avatar

Emil Gardström Emilgardis

  • Sweden
  • 12:10 (UTC +02:00)
View GitHub Profile
@Emilgardis
Emilgardis / gist:b02e4583f9b2624c08a4
Last active August 29, 2015 14:24
Good python snippets
def memoize(f):
def wrapped(*args, **kwargs):
if hasattr(wrapped, '_cached_val'):
return wrapped._cached_val
result = f(*args, **kwargs)
wrapped._cached_val = result
return result
return wrapped
@Emilgardis
Emilgardis / primerelated.py
Created December 16, 2015 14:10
Number of various prime generators, and even more
#!usr/bin/env python3.4
# coding: utf-8
"""Prime related stuff, really useful.
Various sources.
Examples
>>> divisors(24)
{1, 2, 3, 4, 6, 8, 12}
>>> prime_factors(24)
[2, 2, 2, 3]
"""
@Emilgardis
Emilgardis / About
Last active April 10, 2016 17:37
Racer not autocompleting
I'm using rustup with rustc 1.9.0-nightly (526f2bf5c 2016-04-09) on windows.
CARGO_HOME = C:\Users\Emil\.cargo
RUST_SRC_PATH = D:\.local\source\rust\src (*master from today, 526f2bf)
RUST_LOG = debug
@Emilgardis
Emilgardis / ycm.log
Created March 25, 2017 19:34
ycm 2586
2017-03-25 19:42:43,718 - ERROR - Unable to connect to server
Traceback (most recent call last):
File "/home/localsys/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/connection.py", line 137, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/home/localsys/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/util/connection.py", line 91, in create_connection
raise err
File "/home/localsys/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/util/connection.py", line 81, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
Included patches: 1-329
Compiled by Arch Linux
Huge version without GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_sgr +tag_old_static
+arabic +find_in_path -mouse_sysmouse -tag_any_white
+autocmd +float +mouse_urxvt +tcl/dyn
-balloon_eval +folding +mouse_xterm +termguicolors
-browse -footer +multi_byte +terminfo
++builtin_terms +fork() +multi_lang +termresponse
+byte_offset +gettext -mzscheme +textobjects
extern crate cortex_m;
extern crate cortex_m_rt;
#[macro_use]
extern crate cortex_m_rtfm;
extern crate pac; // Our peripheral access crate
use rtfm::{C1, P0, P1, Resource, T0, T1, TMax};
peripherals! {
GPIOA: Peripheral {
@Emilgardis
Emilgardis / gist:d88ad1b0ff3d4c8bb7b021d1ae4bcb29
Last active January 22, 2018 10:10
Advanced Scene Switcher OBS crash
Unhandled exception: c0000005
Date/Time: 2018-01-22, 10:45:23
Fault address: 7FF88103F497 (d:\program files (x86)\obs-studio\obs-plugins\64bit\advanced-scene-switcher.dll)
libobs version: 20.1.3
Windows version: 10.0 build 15063 (revision: 850; 64-bit)
CPU: Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz
Thread 1854 (Crashed)
Stack EIP Arg0 Arg1 Arg2 Arg3 Address
1
00:00:00,000 --> 00:00:03,416
KODJO: At 9, since this last segment got a bit of the rails, we have of course a guest
2
00:00:03,416 --> 00:00:08,875
and that is Anniefuchsia who is super big on twitch and we are going to learn all about it
3
00:00:11,291 --> 00:00:15,125
// ==UserScript==
// @name clone_github_on_vscode
// @namespace http://greasespot.net/
// @version 0.2
// @description Let you open Github repositories in vscode
// @author idanp, emilgardis
// @match https://github.com/*
// @grant none
// ==/UserScript==
@Emilgardis
Emilgardis / Cargo.toml
Last active September 13, 2021 21:49
Cargo build hangs - minimized, but not really rust-lang/rust#88862
[package]
name = "maybe"
version = "0.1.0"
edition = "2018"
resolver = "2"
[dependencies]
sqlx = { version = "0.5.7", default-features = false, features = [
"runtime-tokio-native-tls",