Skip to content

Instantly share code, notes, and snippets.

View MrAndrewMal's full-sized avatar
🏠
Working from home

André MrAndrewMal

🏠
Working from home
View GitHub Profile
@tylerwalts
tylerwalts / update_library.pre.sh
Last active December 16, 2020 11:43
Bash script to add a ssh key to a user's home ssh config. Used prior to running a puppet librarian as part of a server bootstrap process.
#!/bin/sh
# Place the SSH key for the git service account used to access private repositories
home_path="$(cd && pwd)"
ssh_path="$home_path/.ssh"
mkdir -p $ssh_path
provider="bitbucket.org"
#provider="github.com"
@umidjons
umidjons / sort-object-properties-by-value.md
Last active January 16, 2024 13:00
JavaScript: sort object properties by value (numeric or string)

Sort object properties by value (values are text)

I have following object:

var cities={10:'Tashkent', 14:'Karakalpakiya', 16:'Andijan'};

I want sort it by city names, so after sort it should be:

var cities={16:'Andijan', 14:'Karakalpakiya', 10:'Tashkent'};

But I can't sort object properties, instead can convert object into array, then sort items.

@vladimirtsyupko
vladimirtsyupko / gist:10964772
Created April 17, 2014 08:32
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@joshcarr
joshcarr / window-height-width.js
Created July 3, 2014 00:04
vanilla JS window width and height
// vanilla JS window width and height
var w=window,
d=document,
e=d.documentElement,
g=d.getElementsByTagName('body')[0],
x=w.innerWidth||e.clientWidth||g.clientWidth,
y=w.innerHeight||e.clientHeight||g.clientHeight;
@mikehazell
mikehazell / robbyrussell.zsh_theme
Last active July 16, 2024 00:32
oh-my-zsh Default Theme plus Node version info
# oh-my-zsh Theme
# Default robbyrussell theme with node version info.
# Installation: place this file in .oh-my-zsh/custom/themes/robbyrussell.zsh_theme
function node_prompt_version {
if which node &> /dev/null; then
echo "%{$fg_bold[blue]%}node(%{$fg[red]%}$(node -v)%{$fg[blue]%}) %{$reset_color%}"
fi
}
@fnky
fnky / promise-tuple.js
Last active December 18, 2023 19:54
Retrieve tuples from Promise results / async functions
/**
* Returns a Promise which resolves with a value in form of a tuple.
* @param promiseFn A Promise to resolve as a tuple.
* @returns Promise A Promise which resolves to a tuple of [error, ...results]
*/
export function tuple (promise) {
return promise
.then((...results) => [null, ...results])
.catch(error => [error])
}
@tegansnyder
tegansnyder / Preventing-Puppeteer-Detection.md
Created February 23, 2018 02:41
Preventing Puppeteer Detection

I’m looking for any tips or tricks for making chrome headless mode less detectable. Here is what I’ve done so far:

Set my args as follows:

const run = (async () => {

    const args = [
        '--no-sandbox',
        '--disable-setuid-sandbox',
        '--disable-infobars',
@jfstenuit
jfstenuit / Huawei WWAN.md
Last active November 14, 2023 15:16
Using a Huawei WWAN dongle on Linux

Introduction

Installing Huawei E3531 Surf Stick on Linux

May be a valuable insight for more modern surf sticks like Huawei E8231 and the likes ...

Linux is currently Ubuntu, Debian or Raspbian should be similar

The problem

This Huawei Surf stick has several USB mode. It appears first as CD-ROM-like device, so that Windows users can install their driver, then switches mode to appear as "something else". By defaut, this is a network card (virtually connected to a router),

@kicumkicum
kicumkicum / Инструменты_разработчика_в_SmartTV.md
Last active March 15, 2024 09:17
План доклада об инструментов отладки Smart TV приложений

Идея

Отладка SmartTV больная тема для большинства разработчиков. Мысли о том, что придется делать все в слепую отталкивают разработчиков, что негативно влияет на отрасль SmartTV и Web в целом. Я рассказажу, что не все так плохо и инструменты существуют. А те, которых нет не сложно запилить самому.

Официальные средства

@laat
laat / tizen.sh
Last active March 9, 2024 11:06
Notes on Tizen commands that might work
sdb connect <ip>:<port> # connect to TV
sdb -s <deviceName> capability # get <installationPath>
# build
tizen cli-config "default.profiles.path=<profile_path>"
tizen build-web -out .buildResult -- <source-dir>
tizen package --type wgt --sign profileName -- <source-dir>/.buildResult # extract <package-file>
mv <package-file> .
rm -rf <source-dir>/.buildResult