Skip to content

Instantly share code, notes, and snippets.

@cpfarher
cpfarher / gist:466aec5c8920d446abecf8eee5064b2a
Created November 2, 2020 11:00
fix asus fx505dt on ubuntu video problem
nano /usr/share/applications/google-chrome.desktop
Exec=/usr/bin/google-chrome-stable %U --use-cmd-decoder=validating --use-gl=desktop
sudo nano /usr/share/X11/xorg.conf.d/10-amdgpu.conf
Section "OutputClass"
Identifier "AMDgpu"
MatchDriver "amdgpu"
Driver "modesetting"
EndSection
https://www.evilbox.ro/linux/how-to-monitor-mustek-powermust-2012-ups-with-ubuntu-server-14/
@cpfarher
cpfarher / gist:2e2c88a410e7013452d947084494d0d4
Created June 22, 2018 19:22
merge upstream into my master local branch
# kudos to https://github.com/drewlesueur
# stolen from here: https://github.com/blog/266-fast-forward-your-fork#comment-11535
git checkout -b upstream-master
git remote add upstream git://github.com/documentcloud/underscore.git
git pull upstream master
git checkout master // [my master branch]
git merge upstream-master
git push origin master
ffprobe version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2007-2017 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609 configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-li
@cpfarher
cpfarher / UtilsString.rb
Created April 18, 2018 20:35
String ASCII to UTF prototype conversion
module UtilString
STRING_SANITIZE_MAPPINGS = [
{:hex=>0xA5.chr, :hex_no_chr=>"\xA5", :dec=>165, :str=>"Ñ"},
{:hex=>0x80.chr, :hex_no_chr=>"\x80", :dec=>128, :str=>"Ç"},
{:hex=>0xA8.chr, :hex_no_chr=>"\xA8", :dec=>168, :str=>"¿"},
{:hex=>0xAD.chr, :hex_no_chr=>"\xAD", :dec=>173, :str=>"¡"},
{:hex=>0xA4.chr, :hex_no_chr=>"\xA4", :dec=>164, :str=>"ñ"},
{:hex=>0x87.chr, :hex_no_chr=>"\x87", :dec=>87, :str=>"ç"}
]
# string_to_db convert string $data with multibyte character to string utf-8 compatible using the mapping defined in UNIT::STRING_SANITIZE_MAPPINGS
/etc/network/interfaces
ubuntu@scada:/etc/network$ cat interfaces
# This file describes the network interfaces available on your system
# dos ip para una misma interfaz de red.
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# app/admin/recipe.rb
index do
#...
column "Peso1/Peso2" do |f|
div status_tag "#{f.peso} kg." if f.peso
setpoint_lines=[f.sum_setpoints]
setpoint_lines<< ((setpoint_lines[0]!=f.peso_batch)? "error" : "ok")
title_error="Error" if setpoint_lines[1]=="error"
div status_tag "#{setpoint_lines[0]} kg.", setpoint_lines[1], title: title_error || "" unless setpoint_lines[0].blank?
end
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
Handle 0x0005, DMI type 5, 20 bytes
Memory Controller Information
Error Detecting Method: None
Error Correcting Capabilities:
None
Supported Interleave: One-way Interleave
Current Interleave: One-way Interleave
portainer:
restart: unless-stopped
image: portainer/portainer
ports:
- "9000:9000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
require 'singleton'
class Connection
include Singleton
attr_accessor :data
def initialize
@data = {}
end