Skip to content

Instantly share code, notes, and snippets.

@tarzak
tarzak / fix_mic_lenovo320.md
Last active June 15, 2021 16:07 — forked from Therises/fix_mic_lenovo320.md
Fix microphone on Lenovo IdeaPad 320 on Ubuntu 18.04

In /usr/share/pulseaudio/alsa-mixer/paths/analog-input-internal-mic.conf and /usr/share/pulseaudio/alsa-mixer/paths/analog-input-mic.conf:

  • Under [Element Internal Mic Boost] set volume to zero.
  • Under [Element Int Mic Boost] set volume to zero.
  • Under [Element Mic Boost] set volume to zero

Find your source name from the following command; mine is alsa_input.pci-0000_00_1f.3.analog-stereo

  $ pacmd list-sources | grep 'name:.*input'

Edit /etc/pulse/default.pa and add the following lines, where INPUT_NAME is name of the input source from above step:

@tarzak
tarzak / enzyme_render_diffs.md
Created September 26, 2019 15:02 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@tarzak
tarzak / mongoose-connection.js
Created August 19, 2019 18:15 — forked from emilioriosvz/mongoose-connection.js
connect with mongoose using async/await
const mongoose = require('mongoose')
mongoose.Promise = Promise
mongoose.connection.on('connected', () => {
console.log('Connection Established')
})
mongoose.connection.on('reconnected', () => {
console.log('Connection Reestablished')
var unique = 'ab';
var all = 'Aaabbb';
var uniqueArr = unique.split('');
var allArr = all.split('');
function converToObj(accum, currentEl) {
if (!accum[currentEl]) accum[currentEl] = true;
return accum;
const obj = {
translationX: -10, // translation for label to move it a bit left
barTranslationX: 7, // translation for bar to move it a bit right
coefficientTranslationYForLeastValuable: 10,
coefficientTranslationY: 26, // translation for label to move it right down in a row with 0 valuable scores
getYTranslation: function(value) {console.log(this, value);
return value === 0.1 ? this.coefficientTranslationYForLeastValuable : value * this.coefficientTranslationY + 2 * value + 7}
};
export default obj;
State Under 5 Years 5 to 13 Years 14 to 17 Years 18 to 24 Years 25 to 44 Years 45 to 64 Years 65 Years and Over
CA 2704659 4499890 2159981 3853788 10604510 8819342 4114496
TX 2027307 3277946 1420518 2454721 7017731 5656528 2472223
NY 1208495 2141490 1058031 1999120 5355235 5120254 2607672
FL 1140516 1938695 925060 1607297 4782119 4746856 3187797
IL 894368 1558919 725973 1311479 3596343 3239173 1575308
PA 737462 1345341 679201 1203944 3157759 3414001 1910571
x y value
France Apricot 2.3129545439964723
France Avocado 3.1610140317890965
France Lemon 0.9075695440623942
France Date 1.1296454803177811
France Strawberry
France Mandarin 2.6193568568512493
France Chestnut 0.08748279136251946
France Nuts 2.943858242639327
France Olive 1.3356914547843943
{
"extends": ["eslint:recommended", "plugin:react/recommended"],
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"plugins": [
"react"
],
@tarzak
tarzak / is_installed.sh
Created February 16, 2017 17:15 — forked from JamieMason/is_installed.sh
Check if a program exists from a bash script. Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
let name = event.target['organisation-name'].value.trim();
let description = event.target['organisation-description'].value.trim();
let companySite = event.target['company-site'].value.trim();
let iconUrl = template.iconUrl.get();