Skip to content

Instantly share code, notes, and snippets.

View Fire-Dragon-DoL's full-sized avatar

Francesco Belladonna Fire-Dragon-DoL

View GitHub Profile
@Fire-Dragon-DoL
Fire-Dragon-DoL / 00-throttle-zoom
Last active June 29, 2023 14:51 — forked from abraithwaite/chill-zoom.sh
FEDORA version - Zoom in Systemd Cgroups on Linux. Change the max allocations to fit your workstation.
#!/usr/bin/env bash
# throttle-zoom '0-1' '6G'
set -xe
main() (
allowedCpus="${1?Missing allowed CPUs, ex: 0-4}"
maxMemory="${2?Missing max memory, ex: 6G}"
@abraithwaite
abraithwaite / chill-zoom.sh
Last active May 8, 2024 08:43
Zoom in Systemd Cgroups on Linux. Change the max allocations to fit your workstation.
#!/usr/bin/bash -xe
cat <<EOF > "${HOME}/.config/systemd/user/zoom.slice"
[Slice]
AllowedCPUs=0-4
MemoryHigh=6G
EOF
cat /usr/share/applications/Zoom.desktop | sed -E 's#^(Exec=).*$#Exec=/usr/bin/systemd-run --user --slice=zoom.slice /opt/zoom/ZoomLauncher#' > "${HOME}/.local/share/applications/Zoom.desktop"

Arch

Arch Install Script

partition drive

  • view drives: fdisk -l
  • gdisk <drive>
  • d (delete) all
  • efi: n, <default> - +512M, EFI
  • root: n, <default> - -0, Linux Filesystem
  • w (write and save)
@fosskers
fosskers / 2019-polyglot-haskell-dancing.org
Created May 27, 2019 16:16
Dancing in Haskell: Beauty, Correctness, and Good Technique

Dancing in Haskell: Beauty, Correctness, and Good Technique

Beauty, Correctness, and Good Technique

@kipcole9
kipcole9 / Map.Helpers
Last active October 24, 2023 22:13
Helpers for Elixir Maps: underscore, atomise and stringify map keys
defmodule Map.Helpers do
@moduledoc """
Functions to transform maps
"""
@doc """
Convert map string camelCase keys to underscore_keys
"""
def underscore_keys(nil), do: nil
@SiZapPaaiGwat
SiZapPaaiGwat / webpack.nginx.conf
Last active November 19, 2021 19:10
webpack-dev-server configuration in nginx on development server
upstream ws_server {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name 10.1.2.225;
location / {
proxy_pass http://ws_server/;
@Fire-Dragon-DoL
Fire-Dragon-DoL / ProtectedMethod.cpp
Last active August 29, 2015 14:08
Ruby (2.1+) protected method weirdness. Fails with "NoMethodError", accessing protected method. See Ruby code in action: https://eval.in/209730 See Java code in action: http://ideone.com/2B3CEq See C# code in action: http://ideone.com/RJjn4f See C++ code in action: http://ideone.com/7Ihvw0 See Ruby alternative code in action: https://eval.in/209934
#include <iostream>
using namespace std;
class A;
class B;
class C;
class A
{
public:
@flipjs
flipjs / app.js
Last active August 29, 2015 14:06
Angular: bindToController
/*=================================================
= Angular: bindToController =
=================================================*/
void (function(app) {
'use strict';
app.controller('ParentController', ParentCtrl)
@Fire-Dragon-DoL
Fire-Dragon-DoL / application_controller.rb
Last active August 29, 2015 14:05
Token authentication for APIs using rails-api, interactor-rails, jsend-rails, cancancan, skipping Devise (only 2 functions used)
class ApplicationController < ActionController::API
include AbstractController::Translation
include ActionController::MimeResponds
include ActionController::ImplicitRender
include ActionController::StrongParameters
# Gems that tries to include something in ActionController::Base
include JSend::Rails::Controller
include CanCan::ControllerAdditions
@traviskaufman
traviskaufman / jasmine-this-vars.md
Last active September 19, 2022 14:35
Better Jasmine Tests With `this`

Better Jasmine Tests With this

On the Refinery29 Mobile Web Team, codenamed "Bicycle", all of our unit tests are written using Jasmine, an awesome BDD library written by Pivotal Labs. We recently switched how we set up data for tests from declaring and assigning to closures, to assigning properties to each test case's this object, and we've seen some awesome benefits from doing such.

The old way

Up until recently, a typical unit test for us looked something like this:

describe('views.Card', function() {