Skip to content

Instantly share code, notes, and snippets.

@VirgilMing
VirgilMing / gist:fea79e5a9fb721a073ee
Created June 5, 2015 09:16
sudo systemctl status docker -l
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2015-06-05 09:10:46 UTC; 4min 40s ago
Docs: http://docs.docker.com
Process: 1089 ExecStart=/usr/bin/docker -d -H fd:// (code=exited, status=1/FAILURE)
Main PID: 1089 (code=exited, status=1/FAILURE)
Jun 05 09:10:46 scarlet docker[1089]: time="2015-06-05T09:10:46Z" level=info msg="Loading containers: start."
Jun 05 09:10:46 scarlet docker[1089]: time="2015-06-05T09:10:46Z" level=info msg="Loading containers: done."
Jun 05 09:10:46 scarlet docker[1089]: time="2015-06-05T09:10:46Z" level=info msg="docker daemon: 1.6.2 7c8fca2; execdriver: native-0.2; graphdriver: aufs"
virgilmbp:yeah virgilming$ bin/rails generate controller welcome index
create app/controllers/welcome_controller.rb
/Users/virgilming/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `initialize': Permission denied @ rb_sysopen - /Users/virgilming/railsss/yeah/app/controllers/welcome_controller.rb (Errno::EACCES)
from /Users/virgilming/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `open'
from /Users/virgilming/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block in invoke!'
from /Users/virgilming/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `call'
from /Users/virgilming/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
from /Users/virgilming/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/action
@VirgilMing
VirgilMing / test.cpp
Last active November 15, 2017 16:25
myCircleHash
// tested on gcc version 7.2.0 (Homebrew GCC 7.2.0 --with-jit) on macOS 10.12.6
#include <string>
#include <iostream>
#include <functional> // std::hash
int NextCoprime(int (&c)[0xff], char x)
{
return c[x] = (c[x] - x) * c[x] + x;
}
int NextPair(int a, int b, int (&c)[0xff], char x, char y)
{
@VirgilMing
VirgilMing / a.cpp
Last active November 20, 2017 14:23
Lexical minimal string rotation
std::string minimum_representation(std::string S)
{
int i = 0, j = 1, n = S.size();
S += S;
while (j < n)
{
int k = 0;
while (j+k < 2*n && S[i+k] == S[j+k]) ++k;
if (j+k == 2*n)
break;
@VirgilMing
VirgilMing / centering-google.css
Created March 31, 2018 02:47
Centering Google search results for wide screen
/* to be used with stylish, URL starting with https://www.google.com/search */
#cnt #center_col,
.mw #center_col {
margin: auto !important;
width: 50em;
}
.mw {
margin-left: auto;
margin-right: auto;
}
Frutiger
Univers
ITC Avant Garde Gothic Std
ITC Century Std
ITC Cheltenham Std
Garth Graphic
Gill Sans Std
Kepler Std
Myriad Pro
@VirgilMing
VirgilMing / gist:13fa240b7b6d8c214989f2d5455edfa0
Created October 18, 2021 14:33
To build VIM with everything on Ubuntu
# sudo apt-get build-dep vim
[clone VIM repo from GitHub]
# ./configure
--with-features=huge
--enable-multibyte
--enable-rubyinterp
--enable-python3interp
--with-python-config-dir=/usr/lib/python3.8/config-3.8-x86_64-linux-gnu
@VirgilMing
VirgilMing / swap Caps|Lctrl and Esc|Grave.ahk
Last active August 25, 2022 08:17
AHK script to swap keys on certain keyboard
; Requires AutoHotInterception: https://github.com/evilC/AutoHotInterception
; Follow setup section
; Swaps leftctrl and capslock; escape and grave
#SingleInstance force
#Persistent
#include <AutoHotInterception> ; assumes libs already copied to AHK lib
; location, to allow execution in any location
global AHI := new AutoHotInterception()
global kID := AHI.GetKeyboardIdFromHandle("ACPI\VEN_LEN&DEV_0071")