Skip to content

Instantly share code, notes, and snippets.

@giladno
giladno / setup.md
Last active August 29, 2022 22:44
Flutter

Install Android Emulator

sdkmanager "system-images;android-33;google_apis;x86_64"
avdmanager create avd -n emulator -k "system-images;android-33;google_apis;x86_64"

Then edit ~/.android/avd/emulator.avd/config.ini and increase disk.dataPartition.size You can then use VSCode to launch it

@giladno
giladno / android.md
Created July 9, 2022 19:59
Android SDK
brew install --cask android-commandlinetools android-platform-tools temurin

Setup environment variable

export ANDROID_HOME=/usr/local/share/android-commandlinetools

Install sdk components

@giladno
giladno / copy.js
Created June 21, 2021 21:33
Copy to clipboard in js
export function copy (text) {
if (window.clipboardData && window.clipboardData.setData) {
return window.clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
textarea.style.position = "fixed";
document.body.appendChild(textarea);
textarea.select();
try {
@giladno
giladno / psql.md
Created October 14, 2020 14:01
psql

brew install libpq brew link --force libpq

export PGHOST=127.0.0.1

@giladno
giladno / github_runner.sh
Last active July 26, 2020 12:27
Setup github runner
#!/bin/bash
# curl -s -L https://gist.githubusercontent.com/giladno/82614109269d0a88029cbff4dafd0d19/raw/ | bash
mkdir actions-runner && cd actions-runner
curl -O -L https://github.com/actions/runner/releases/download/v2.267.1/actions-runner-linux-x64-2.267.1.tar.gz
tar xzf ./actions-runner-linux-x64-2.267.1.tar.gz
./config.sh --url https://github.com/letsdeel --token XXXXXXXXXXXXXXX --name `hostname` --labels aws --work _work
sudo ./svc.sh install
sudo ./svc.sh start
@giladno
giladno / s3.xml
Created March 30, 2020 20:47
S3 static hosting policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
@giladno
giladno / docker.md
Last active July 8, 2020 10:11
Docker
  • Stop and remove all containers
docker container stop $(docker container ls -aq)
  • Remove all stopped containers, dangling and unused images, unused networks and unused volumes
docker system prune -a --volumes
@giladno
giladno / index.js
Created December 24, 2018 14:33
inspector
const util = require('util');
const inspector = require('inspector');
const session = new inspector.Session();
const post = util.promisify(session.post).bind(session);
function test() {
console.log('hello');
console.log('world');
return 12345;
FROM node:10-slim
ENV NODE_ENV=production
RUN apt-get update && apt-get install -yq libgconf-2-4
RUN apt-get update && apt-get install -y wget --no-install-recommends \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
@giladno
giladno / hyper.js
Created December 16, 2018 09:04
hyper.js
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks