Skip to content

Instantly share code, notes, and snippets.

View conmute's full-sized avatar
📦
system thinking

Roman M. Koss conmute

📦
system thinking
View GitHub Profile
@conmute
conmute / disable.sh
Created August 23, 2020 20:23
Disable bunch of #$!@ in Catalina
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
@conmute
conmute / list-spec.js
Created February 24, 2019 19:34
`[[1,2,[3]],4] => [1,2,3,4]` full example
import { flatten } from './list'
test('Should return array if not an array', () => {
assert(flatten(1)).toMatchObject([1])
})
test('Should return array if an array', () => {
assert(flatten([1])).toMatchObject([1])
})
@conmute
conmute / herp_the_derp.js
Last active February 4, 2019 15:30
JavaScript Multiple/single line emails into validated and formatted data value… better name?
let str = `
email1@me
email2@me
email3@me;email4@me
`
const parsed = str
.split(';')
.map(line => {
return line
@conmute
conmute / .bash_profile
Last active July 2, 2018 14:32
Load local environment variable files into current scope of terminal session, if any. Just paste to your `.bash_rc/profile`
env_file_names=(
'./.env'
'./.env.local'
)
for file in ${env_file_names[*]}
do
if [ -f "${file}" ]; then
echo "Found local environment file: $file"
echo "Loading..."
. $file
@conmute
conmute / html-w3c-validate.js
Created May 14, 2018 22:19
Script to run all files through w3c checker.
#!/usr/bin/env node
'use strict';
const validate = require('html-angular-validate');
validate.validate(
[
"src/app/ui/**/*.html"
],
{
@conmute
conmute / WebpackRequireListPlugin.js
Last active March 15, 2017 03:08
WebPack plugin examples
import path from "path";
function WebpackRequireListPlugin() {}
WebpackRequireListPlugin.prototype.apply = function(compiler) {
compiler.plugin("emit", function(compilation, callback) {
let filelist = {};
compilation.modules.forEach((item, index) => {
let query = path
.relative(process.cwd(), item.userRequest)
@conmute
conmute / decorate-specific-controller.js
Created November 17, 2016 13:40
Angular 1 snippets
angular.module("app").decorator("$controller", ['$delegate', function($delegate: Function) {
return function(constructor, locals) {
let controller = $delegate.apply($delegate, arguments);
if (constructor === NLayoutDesigner) {
console.log(controller);
return angular.extend(function () {
locals.$scope.smth = "somewhat";
return controller();
}, controller);
}
@conmute
conmute / README.md
Last active August 29, 2015 14:22
functions in Python

Функції

  • Оголошення функції - def_def
  • Порядок оголошення та виклику - def_order
  • Повернення результату - def_return
  • Перевизначення функції - def_redef
  • Збереження функції у перемінінй - def_storing
  • Видимість перемінних - def_var_visibility
  • Аргументи - def_args
  • Зміна переданого аргументу - def_args_ch
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" http://stackoverflow.com/questions/878972/windows-cmd-encoding-change-causes-python-crash#answer-3259271
"""
import sys
if sys.platform == "win32":
import codecs